Skip to content
Myr

test_compat.py

This file

Path

tests/test_compat.py

24 lines · 768 bytes · Python

Last changed by

Fixed generated bash complete function name. This fixes #221Armin Ronacherbefore adoption7c138a6

History of this file

Take it

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

Merge branch '3.x-maintenance'Armin Ronacherbefore adoptione865985

lines 1–17why, one step back
1import click
234if click.__version__ >= '3.0':5 def test_legacy_callbacks(runner):6 def legacy_callback(ctx, value):7 return value.upper()89 @click.command()10 @click.option('--foo', callback=legacy_callback)11 def cli(foo):12 click.echo(foo)1314 result = runner.invoke(cli, ['--foo', 'wat'])15 assert result.exit_code == 016 assert 'WAT' in result.output17 assert 'Invoked legacy parameter callback' in result.output

Fixed generated bash complete function name. This fixes #221Armin Ronacherbefore adoption7c138a6

lines 18–24why, one step back
18
1920def test_bash_func_name():21 from click._bashcomplete import get_completion_script22 script = get_completion_script('foo-bar baz_blah', '_COMPLETE_VAR').strip()23 assert script.startswith('_foo_barbaz_blah_completion()')24 assert '_COMPLETE_VAR=complete $1' in script