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

Function test_bool_underlying_enum

tests/test_enum.py:257–265  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

255
256
257def test_bool_underlying_enum():
258 assert type(m.ScopedBoolEnum.TRUE.__int__()) is int
259 assert int(m.ScopedBoolEnum.FALSE) == 0
260 assert hash(m.ScopedBoolEnum.TRUE) == 1
261 assert type(m.ScopedBoolEnum.TRUE.__getstate__()) is int
262 assert m.ScopedBoolEnum(1) == m.ScopedBoolEnum.TRUE
263 # Enum could construct with a bool
264 # (bool is a strict subclass of int, and False will be converted to 0)
265 assert m.ScopedBoolEnum(False) == m.ScopedBoolEnum.FALSE
266
267
268def test_docstring_signatures():

Callers

nothing calls this directly

Calls 3

hashFunction · 0.85
typeClass · 0.50
__int__Method · 0.45

Tested by

no test coverage detected