Skip to content

Commit 9a42292

Browse files
committed
Adding working (and not working) tests for issue
1 parent 2d440e0 commit 9a42292

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

tests/test_enum.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,18 @@ def test_converstion_enum():
4646
assert m.test_conversion_enum(m.ConversionEnum.Convert1) == "ConversionEnum::Convert1"
4747
assert m.test_conversion_enum(m.ConversionEnum("Convert1")) == "ConversionEnum::Convert1"
4848
assert m.test_conversion_enum("Convert1") == "ConversionEnum::Convert1"
49-
assert m.test_conversion_enum(m.ConversionEnum.Convert1) == "ConversionEnum::Convert1"
49+
50+
51+
def test_conversion_enum_raises():
52+
with pytest.raises(ValueError) as excinfo:
53+
m.ConversionEnum("Convert0")
54+
assert str(excinfo.value) == "\"Convert0\" is not a valid value for enum type ConversionEnum"
55+
56+
57+
def test_conversion_enum_raises_implicit():
58+
with pytest.raises(ValueError) as excinfo:
59+
m.test_conversion_enum("Convert0")
60+
assert str(excinfo.value) == "\"Convert0\" is not a valid value for enum type ConversionEnum"
5061

5162

5263
def test_scoped_enum():

0 commit comments

Comments
 (0)