Ensure objects live long enough in hash test

This commit is contained in:
Hynek Schlawack 2020-10-16 08:35:42 +02:00
parent 9f2a7857dc
commit 83fef48b2d
1 changed files with 7 additions and 1 deletions

View File

@ -450,7 +450,13 @@ class TestFunctional(object):
class C(object):
pass
assert hash(C()) != hash(C())
# Ensure both objects live long enough such that their ids/hashes
# can't be recycled. Thanks to Ask Hjorth Larsen for pointing that
# out.
c1 = C()
c2 = C()
assert hash(c1) != hash(c2)
def test_overwrite_base(self):
"""