MCPcopy Create free account
hub / github.com/apache/tvm-ffi / test_unsafe_hash

Method test_unsafe_hash

tests/python/test_dataclass_py_class.py:642–652  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

640 """__hash__ generation."""
641
642 def test_unsafe_hash(self) -> None:
643 @py_class(_unique_key("Hash"), eq=True, unsafe_hash=True)
644 class Hash(Object):
645 x: int
646
647 a = Hash(x=1)
648 b = Hash(x=1)
649 assert hash(a) == hash(b)
650 # Can be used in sets
651 s = {a, b}
652 assert len(s) == 1
653
654
655# ###########################################################################

Callers

nothing calls this directly

Calls 2

HashClass · 0.85
hashClass · 0.85

Tested by

no test coverage detected