Simplify tests
This commit is contained in:
parent
5a591454e9
commit
3e77f0b2b4
@ -13,26 +13,23 @@ def test_use_sys_argv_by_default():
|
|||||||
assert parse_args() == (['argument'], {'flag': True})
|
assert parse_args() == (['argument'], {'flag': True})
|
||||||
|
|
||||||
def test_single_positional_argument():
|
def test_single_positional_argument():
|
||||||
assert parse_args(['app']) == (['app'], {})
|
assert parse_args(['argument']) == (['argument'], {})
|
||||||
|
|
||||||
def test_single_positional_argument_with_underscore():
|
def test_single_positional_argument_with_underscore():
|
||||||
assert parse_args(['the-app']) == (['the_app'], {})
|
assert parse_args(['the-argument']) == (['the_argument'], {})
|
||||||
assert parse_args(['a-b']) == (['a_b'], {})
|
assert parse_args(['a-b']) == (['a_b'], {})
|
||||||
|
|
||||||
def test_optional_argument_with_underscore():
|
def test_optional_argument_with_underscore():
|
||||||
assert parse_args(['--a-b']) == ([], {'a_b': True})
|
assert parse_args(['--a-b']) == ([], {'a_b': True})
|
||||||
|
|
||||||
def test_positional_arguments():
|
def test_positional_arguments():
|
||||||
assert parse_args(['app', 'command']) == (['app', 'command'], {})
|
assert parse_args(['argument', 'command']) == (['argument', 'command'], {})
|
||||||
|
|
||||||
def test_one_positional_and_optional_argument():
|
def test_one_positional_and_optional_argument():
|
||||||
assert parse_args(['app', '--help']) == (['app'], {'help': True})
|
assert parse_args(['argument', '--help']) == (['argument'], {'help': True})
|
||||||
|
|
||||||
def test_one_positional_and_optional_argument_with_values():
|
def test_one_positional_and_optional_argument_with_values():
|
||||||
assert parse_args(['app', '--amount=2', '3']) == (['app'], {'amount': ['2', '3']})
|
assert parse_args(['argument', '--amount=2', '3']) == (['argument'], {'amount': ['2', '3']})
|
||||||
|
|
||||||
def test_positional_and_optional_arguments():
|
|
||||||
assert parse_args(['argument', '--help']) == (['argument'], {'help': True})
|
|
||||||
|
|
||||||
def test_short_arg_with_single_option():
|
def test_short_arg_with_single_option():
|
||||||
assert parse_args(['-a', 'b', '--abc', 'd']) == ([], {'a': 'b', 'abc': 'd'})
|
assert parse_args(['-a', 'b', '--abc', 'd']) == ([], {'a': 'b', 'abc': 'd'})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user