test_compat.py
This file
Path
tests/test_compat.py
25 lines · 813 bytes · Python
Last changed by
Merge pull request #865 from stopthatcow/feature/323David Lordbefore adoption39e46e0
History of this fileTake it
The walk stopped after 200 commits: lines older than d217382 point at it.
Fix bad import. This fixes #454Armin Ronacherbefore adoptiond217382
line 1why, one step back1import clickMerge branch '6.x-maintenance'Armin Ronacherbefore adoption7404b06
line 2why, one step back2import pytestFix bad import. This fixes #454Armin Ronacherbefore adoptiond217382
lines 3–14why, one step back345if click.__version__ >= '3.0':6 def test_legacy_callbacks(runner):7 def legacy_callback(ctx, value):8 return value.upper()910 @click.command()11 @click.option('--foo', callback=legacy_callback)12 def cli(foo):13 click.echo(foo)14Merge branch '6.x-maintenance'Armin Ronacherbefore adoption7404b06
lines 15–18why, one step back15 with pytest.warns(Warning, match='Invoked legacy parameter callback'):16 result = runner.invoke(cli, ['--foo', 'wat'])17 assert result.exit_code == 018 assert 'WAT' in result.outputFix bad import. This fixes #454Armin Ronacherbefore adoptiond217382
lines 19–22why, one step back192021def test_bash_func_name():22 from click._bashcomplete import get_completion_scriptMerge pull request #865 from stopthatcow/feature/323David Lordbefore adoption39e46e0
line 23why, one step back23 script = get_completion_script('foo-bar baz_blah', '_COMPLETE_VAR', 'bash').strip()Fix bad import. This fixes #454Armin Ronacherbefore adoptiond217382
lines 24–25why, one step back24 assert script.startswith('_foo_barbaz_blah_completion()')25 assert '_COMPLETE_VAR=complete $1' in script