@@ -32,6 +32,8 @@ class ArgChoices(enum.Enum):
AA = 'aa'
AB = 'ab'
BB = 'bb'
START = AA
END = BB
class MockTraceback:
@@ -270,9 +272,9 @@ def test_diff_year(date, diff, expected):
def test_can_run(cmd, expected):
assert cliutil.can_run(cmd) == expected
@pytest.mark.parametrize('choice', ArgChoices)
def test_enum_arg_enum_type(arg_enum, choice):
assert arg_enum.enum_type(choice.name) is choice
@pytest.mark.parametrize('name,choice', ArgChoices.__members__.items())
def test_enum_arg_enum_type(arg_enum, name, choice):
assert arg_enum.enum_type(name.lower()) is choice
assert arg_enum.enum_type(choice.value) is choice
@pytest.mark.parametrize('arg', 'az\0')
@@ -280,9 +282,9 @@ def test_enum_arg_no_enum_match(arg_enum, arg):
with pytest.raises(ValueError):
arg_enum.enum_type(arg)
def test_enum_arg_value_type(arg_enum, choice):
assert arg_enum.value_type(choice.name) == choice.value
def test_enum_arg_value_type(arg_enum, name, choice):
assert arg_enum.value_type(name.lower()) == choice.value
assert arg_enum.value_type(choice.value) == choice.value