Skip to content
Myr

issue #393: Add more tests to support changes.

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

authored by Ryan Siemens · committed by Ryan Siemens · parent 2cae5e9 · Browse files · 1 file+32 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+32 added−0 removed

  • tests:+32 added−0 removed

1 file+32 added−0 removed

modified:tests/test_formatting.py+32 added
172 unmodified lines
173 def foo(bar):174 click.echo('foo:' + bar)175176 result = runner.invoke(cmd, ['foo'])177 assert result.exit_code == 2178 assert result.output.splitlines() == [179 'Usage: cmd foo [OPTIONS] BAR',180 'Try "cmd foo --help" for help.',181 '',182 'Error: Missing argument "bar".'183 ]184185186def test_formatting_usage_error_no_help(runner):187 @click.command(add_help_option=False)188 @click.argument('arg')189 def cmd(arg):190 click.echo('arg:' + arg)191192 result = runner.invoke(cmd, [])193 assert result.exit_code == 2194 assert result.output.splitlines() == [195 'Usage: cmd [OPTIONS] ARG',196 '',197 'Error: Missing argument "arg".'198 ]199200201def test_formatting_usage_custom_help(runner):202 @click.command(context_settings=dict(help_option_names=['--man']))203 @click.argument('arg')204 def cmd(arg):205 click.echo('arg:' + arg)206207 result = runner.invoke(cmd, [])208 assert result.exit_code == 2209 assert result.output.splitlines() == [210 'Usage: cmd [OPTIONS] ARG',211 'Try "cmd --man" for help.',212 '',213 'Error: Missing argument "arg".'214 ]