Skip to content
Myr

replace for loop with parametrize

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by bdista · committed by David Lord · parent 1c42559 · Browse files · 1 file+14 added−14 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+14 added−14 removed

  • tests:+14 added−14 removed

1 file+14 added−14 removed

modified:tests/test_arguments.py+14 added-14 removed
39 unmodified lines
40 assert not result.exception41 assert result.output.splitlines() == ["name=peter", "point=1/2"]424344def test_nargs_tup_composite(runner):45 variations = [44@pytest.mark.parametrize(45 "opts",46 [47 dict(type=(str, int)),48 dict(type=click.Tuple([str, int])),49 dict(nargs=2, type=click.Tuple([str, int])),50 dict(nargs=2, type=(str, int)),50 ]51 ],52)53def test_nargs_tup_composite(runner, opts):54 @click.command()55 @click.argument("item", **opts)56 def copy(item):57 name, id = item58 click.echo(f"name={name} id={id:d}")5952 for opts in variations:60 result = runner.invoke(copy, ["peter", "1"])61 assert result.exception is None62 assert result.output.splitlines() == ["name=peter id=1"]6354 @click.command()55 @click.argument("item", **opts)56 def copy(item):57 name, id = item58 click.echo(f"name={name} id={id:d}")6460 result = runner.invoke(copy, ["peter", "1"])61 assert not result.exception62 assert result.output.splitlines() == ["name=peter id=1"]636465def test_nargs_err(runner):66 @click.command()67 @click.argument("x")68 def copy(x):
311 unmodified lines