Skip to content

Commit

Permalink
Adding a test checking for a custom param type related to #675
Browse files Browse the repository at this point in the history
  • Loading branch information
JosiahDub committed May 15, 2018
1 parent 1782e21 commit f59ae52
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/test_formatting.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,3 +248,23 @@ def cmd(arg):
'',
'Error: Missing argument "ARG".'
]

def test_formatting_custom_type_metavar(runner):
class MyType(click.ParamType):
def get_metavar(self, param):
return "MY_TYPE"

@click.command("foo")
@click.help_option()
@click.argument("param", type=MyType())
def cmd(param):
pass

result = runner.invoke(cmd, '--help')
assert not result.exception
assert result.output.splitlines() == [
'Usage: foo [OPTIONS] MY_TYPE',
'',
'Options:',
' --help Show this message and exit.'
]

0 comments on commit f59ae52

Please sign in to comment.