Пример #1
0
def test_hash_equal_tuple_with_nans():
    a = (float("nan"), (float("nan"), float("nan")))
    b = (float("nan"), (float("nan"), float("nan")))
    assert ht.object_hash(a) == ht.object_hash(b)
    assert ht.objects_are_equal(a, b)
Пример #2
0
 def __hash__(self) -> int:
     # for python>=3.10, different nan objects have different hashes
     # we need  to avoid that und thus use hash function with old behavior
     return object_hash(
         tuple(getattr(self, attr) for attr in self._metadata))