Skip to content
Myr

Adding a test checking for a custom param type related to #675

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

authored by JosiahDub · committed by JosiahDub · parent 1782e21 · Browse files · 1 file+20 added−0 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+20 added−0 removed

  • tests:+20 added−0 removed

1 file+20 added−0 removed

modified:tests/test_formatting.py+20 added
246 unmodified lines
247 'Try "cmd --man" for help.',248 '',249 'Error: Missing argument "ARG".'250 ]251252def test_formatting_custom_type_metavar(runner):253 class MyType(click.ParamType):254 def get_metavar(self, param):255 return "MY_TYPE"256257 @click.command("foo")258 @click.help_option()259 @click.argument("param", type=MyType())260 def cmd(param):261 pass262263 result = runner.invoke(cmd, '--help')264 assert not result.exception265 assert result.output.splitlines() == [266 'Usage: foo [OPTIONS] MY_TYPE',267 '',268 'Options:',269 ' --help Show this message and exit.'270 ]