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

Function test_binary_operators

tests/test_enum.py:203–222  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

201 env.GRAALPY and env.GRAALPY_VERSION < (24, 2), reason="Fixed in GraalPy 24.2"
202)
203def test_binary_operators():
204 assert int(m.Flags.Read) == 4
205 assert int(m.Flags.Write) == 2
206 assert int(m.Flags.Execute) == 1
207 assert int(m.Flags.Read | m.Flags.Write | m.Flags.Execute) == 7
208 assert int(m.Flags.Read | m.Flags.Write) == 6
209 assert int(m.Flags.Read | m.Flags.Execute) == 5
210 assert int(m.Flags.Write | m.Flags.Execute) == 3
211 assert int(m.Flags.Write | 1) == 3
212 assert ~m.Flags.Write == -3
213
214 state = m.Flags.Read | m.Flags.Write
215 assert (state & m.Flags.Read) != 0
216 assert (state & m.Flags.Write) != 0
217 assert (state & m.Flags.Execute) == 0
218 assert (state & 1) == 0
219
220 state2 = ~state
221 assert state2 == -7
222 assert int(state ^ state2) == -1
223
224
225def test_enum_to_int():

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected