Add a test that memoryviews have hash randomization enabled.

This commit is contained in:
Antoine Pitrou 2012-02-21 19:14:26 +01:00
parent 528b54b263
commit 07c65884c6
1 changed files with 6 additions and 0 deletions

View File

@ -186,6 +186,12 @@ class BytesHashRandomizationTests(StringlikeHashRandomizationTests):
def test_empty_string(self):
self.assertEqual(hash(b""), 0)
class MemoryviewHashRandomizationTests(StringlikeHashRandomizationTests):
repr_ = "memoryview(b'abc')"
def test_empty_string(self):
self.assertEqual(hash(memoryview(b"")), 0)
class DatetimeTests(HashRandomizationTests):
def get_hash_command(self, repr_):
return 'import datetime; print(hash(%s))' % repr_