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

Function test_overriding_eq_reset_hash

tests/test_operator_overloading.py:142–155  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

140
141
142def test_overriding_eq_reset_hash():
143 assert m.Comparable(15) is not m.Comparable(15)
144 assert m.Comparable(15) == m.Comparable(15)
145
146 with pytest.raises(TypeError) as excinfo:
147 hash(m.Comparable(15))
148 assert str(excinfo.value).startswith("unhashable type:")
149
150 for hashable in (m.Hashable, m.Hashable2):
151 assert hashable(15) is not hashable(15)
152 assert hashable(15) == hashable(15)
153
154 assert hash(hashable(15)) == 15
155 assert hash(hashable(15)) == hash(hashable(15))
156
157
158def test_return_set_of_unhashable():

Callers

nothing calls this directly

Calls 2

hashFunction · 0.85
strClass · 0.85

Tested by

no test coverage detected