diff --git a/tests/test_enum.py b/tests/test_enum.py index a29e5a40aee..7b1c12727a2 100644 --- a/tests/test_enum.py +++ b/tests/test_enum.py @@ -62,7 +62,18 @@ def test_converstion_enum(): assert m.test_conversion_enum(m.ConversionEnum.Convert1) == "ConversionEnum::Convert1" assert m.test_conversion_enum(m.ConversionEnum("Convert1")) == "ConversionEnum::Convert1" assert m.test_conversion_enum("Convert1") == "ConversionEnum::Convert1" - assert m.test_conversion_enum(m.ConversionEnum.Convert1) == "ConversionEnum::Convert1" + + +def test_conversion_enum_raises(): + with pytest.raises(ValueError) as excinfo: + m.ConversionEnum("Convert0") + assert str(excinfo.value) == "\"Convert0\" is not a valid value for enum type ConversionEnum" + + +def test_conversion_enum_raises_implicit(): + with pytest.raises(ValueError) as excinfo: + m.test_conversion_enum("Convert0") + assert str(excinfo.value) == "\"Convert0\" is not a valid value for enum type ConversionEnum" def test_scoped_enum():