Skip to content

Commit

Permalink
test: fix test incorrectly checking for hash collision avoidance
Browse files Browse the repository at this point in the history
  • Loading branch information
QuentinSoubeyranAqemia committed Nov 15, 2023
1 parent c756c1f commit e512b4b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/test_main.py
Expand Up @@ -651,9 +651,11 @@ class TestModel(BaseModel):
assert hash(m) == h

# Keys can be missing, e.g. when using the deprecated copy method.
# This should change the hash, and more importantly hashing shouldn't raise a KeyError.
# This could change the hash, and more importantly hashing shouldn't raise a KeyError
# We don't assert here, because a hash collision is possible: the hash is not guaranteed to change
# However, hashing must not raise an exception, which simply calling hash() checks for
del m.__dict__['a']
assert h != hash(m)
hash(m)


def test_default_hash_function_overrides_default_hash_function():
Expand Down

0 comments on commit e512b4b

Please sign in to comment.