diff options
Diffstat (limited to 'ext/pybind11/tests/test_enum.py')
-rw-r--r-- | ext/pybind11/tests/test_enum.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/ext/pybind11/tests/test_enum.py b/ext/pybind11/tests/test_enum.py index de5f3c6f6..ba7e22ab0 100644 --- a/ext/pybind11/tests/test_enum.py +++ b/ext/pybind11/tests/test_enum.py @@ -7,6 +7,15 @@ def test_unscoped_enum(): assert str(UnscopedEnum.EOne) == "UnscopedEnum.EOne" assert str(UnscopedEnum.ETwo) == "UnscopedEnum.ETwo" assert str(EOne) == "UnscopedEnum.EOne" + # __members__ property + assert UnscopedEnum.__members__ == {"EOne": UnscopedEnum.EOne, "ETwo": UnscopedEnum.ETwo} + # __members__ readonly + with pytest.raises(AttributeError): + UnscopedEnum.__members__ = {} + # __members__ returns a copy + foo = UnscopedEnum.__members__ + foo["bar"] = "baz" + assert UnscopedEnum.__members__ == {"EOne": UnscopedEnum.EOne, "ETwo": UnscopedEnum.ETwo} # no TypeError exception for unscoped enum ==/!= int comparisons y = UnscopedEnum.ETwo |