Skip to content
Myr

test_termui.py

This file

Path

tests/test_termui.py

71 lines · 1.9 KiB · Python

Last changed by

Merge branch 'Rovanion-master'Markus Unterwaditzerbefore adoption67f39e4

History of this file

Take it

The walk stopped after 200 commits: lines older than a4d02ff point at it.

Fixed an rst syntax errorArmin Ronacherbefore adoptiona4d02ff

lines 1–14why, one step back
1import click
234def test_progressbar_strip_regression(runner, monkeypatch):5 label = ' padded line'67 @click.command()8 def cli():9 with click.progressbar(tuple(range(10)), label=label) as progress:10 for thing in progress:11 pass1213 monkeypatch.setattr(click._termui_impl, 'isatty', lambda _: True)14 assert label in runner.invoke(cli, []).output

Merge pull request #488 from RonnyPfannschmidt/fix-termioArmin Ronacherbefore adoption8ed2573

lines 15–44why, one step back
15
1617def test_progressbar_length_hint(runner, monkeypatch):18 class Hinted(object):19 def __init__(self, n):20 self.items = list(range(n))2122 def __length_hint__(self):23 return len(self.items)2425 def __iter__(self):26 return self2728 def __next__(self):29 if self.items:30 return self.items.pop()31 else:32 raise StopIteration3334 next = __next__3536 @click.command()37 def cli():38 with click.progressbar(Hinted(10), label='test') as progress:39 for thing in progress:40 pass4142 monkeypatch.setattr(click._termui_impl, 'isatty', lambda _: True)43 result = runner.invoke(cli, [])44 assert result.exception is None

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 45–46why, one step back
45
46

Merge branch 'Rovanion-master'Markus Unterwaditzerbefore adoption67f39e4

lines 47–66why, one step back
47def test_choices_list_in_prompt(runner, monkeypatch):
48 @click.command()49 @click.option('-g', type=click.Choice(['none', 'day', 'week', 'month']),50 prompt=True)51 def cli_with_choices(g):52 pass5354 @click.command()55 @click.option('-g', type=click.Choice(['none', 'day', 'week', 'month']),56 prompt=True, show_choices=False)57 def cli_without_choices(g):58 pass5960 result = runner.invoke(cli_with_choices, [], input='none')61 assert '(none, day, week, month)' in result.output6263 result = runner.invoke(cli_without_choices, [], input='none')64 assert '(none, day, week, month)' not in result.output6566

Merge branch 'her0e1c1-fix-secho'Markus Unterwaditzerbefore adoption2899795

lines 67–71why, one step back
67def test_secho(runner):
68 with runner.isolation() as out:69 click.secho(None, nl=False)70 bytes = out.getvalue()71 assert bytes == b''