Skip to content
Myr

add boolean conversion test

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

authored by axu2 · committed by axu2 · parent 417da8f · Browse files · 1 file+22 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+22 added−0 removed

  • tests:+22 added−0 removed

1 file+22 added−0 removed

modified:tests/test_basic.py+22 added
178 unmodified lines
179 assert not result.exception180 assert result.output == '%s\n' % (default)181182183def test_boolean_conversion(runner):184 for default in True, False:185 @click.command()186 @click.option('--flag', default=default, type=bool)187 def cli(flag):188 click.echo(flag)189190 for value in 'true', 't,' '1', 'yes', 'y':191 result = runner.invoke(cli, ['--flag', value])192 assert not result.exception193 assert result.output == 'True\n'194195 for value in 'false', 'f', '0', 'no', 'n':196 result = runner.invoke(cli, ['--flag', value])197 assert not result.exception198 assert result.output == 'False\n'199200 result = runner.invoke(cli, [])201 assert not result.exception202 assert result.output == '%s\n' % default203204205def test_file_option(runner):206 @click.command()207 @click.option('--file', type=click.File('w'))208 def input(file):
290 unmodified lines