test_compat.py
This file
Path
tests/test_compat.py
17 lines · 490 bytes · Python
Last changed by
Do not warn about callback changes until 3.0Armin Ronacherbefore adoption236e09c
History of this fileTake it
Changed parameter callback signature.Armin Ronacherbefore adoptionbda39db
lines 1–3why, one step back1import click23Do not warn about callback changes until 3.0Armin Ronacherbefore adoption236e09c
lines 4–7why, one step back4if click.__version__ >= '3.0':5 def test_legacy_callbacks(runner):6 def legacy_callback(ctx, value):7 return value.upper()Changed parameter callback signature.Armin Ronacherbefore adoptionbda39db
line 8why, one step back8Do not warn about callback changes until 3.0Armin Ronacherbefore adoption236e09c
lines 9–12why, one step back9 @click.command()10 @click.option('--foo', callback=legacy_callback)11 def cli(foo):12 click.echo(foo)Changed parameter callback signature.Armin Ronacherbefore adoptionbda39db
line 13why, one step back13Do not warn about callback changes until 3.0Armin Ronacherbefore adoption236e09c
lines 14–17why, one step back14 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