mirror of
https://github.com/pybind/pybind11.git
synced 2026-04-20 06:49:25 +00:00
check for already existing enum value added; added test (#1453)
* check for already existing enum value added; added test * added enum value name to exception message * test for defining enum with multiple identical names moved to test_enum.cpp/py
This commit is contained in:
committed by
Wenzel Jakob
parent
35c82c7250
commit
5c8746ff13
@@ -148,3 +148,9 @@ def test_enum_to_int():
|
||||
m.test_enum_to_uint(m.ClassWithUnscopedEnum.EMode.EFirstMode)
|
||||
m.test_enum_to_long_long(m.Flags.Read)
|
||||
m.test_enum_to_long_long(m.ClassWithUnscopedEnum.EMode.EFirstMode)
|
||||
|
||||
|
||||
def test_duplicate_enum_name():
|
||||
with pytest.raises(ValueError) as excinfo:
|
||||
m.register_bad_enum()
|
||||
assert str(excinfo.value) == "Enum error - element with name: ONE already exists"
|
||||
|
||||
Reference in New Issue
Block a user