MCPcopy Create free account
hub / github.com/pybind/pybind11 / test_char_underlying_enum

Function test_char_underlying_enum

tests/test_enum.py:246–254  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

244
245
246def test_char_underlying_enum(): # Issue #1331/PR #1334:
247 assert type(m.ScopedCharEnum.Positive.__int__()) is int
248 assert int(m.ScopedChar16Enum.Zero) == 0
249 assert hash(m.ScopedChar32Enum.Positive) == 1
250 assert type(m.ScopedCharEnum.Positive.__getstate__()) is int
251 assert m.ScopedWCharEnum(1) == m.ScopedWCharEnum.Positive
252 with pytest.raises(TypeError):
253 # Even if the underlying type is char, only an int can be used to construct the enum:
254 m.ScopedCharEnum("0")
255
256
257def test_bool_underlying_enum():

Callers

nothing calls this directly

Calls 3

hashFunction · 0.85
typeClass · 0.50
__int__Method · 0.45

Tested by

no test coverage detected