From: Antoine Pitrou Date: Tue, 21 Feb 2012 18:14:26 +0000 (+0100) Subject: Add a test that memoryviews have hash randomization enabled. X-Git-Tag: v3.3.0a1~107 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=07c65884c635f1d4ea8f5fa8598d4dd091804aba;p=thirdparty%2FPython%2Fcpython.git Add a test that memoryviews have hash randomization enabled. --- diff --git a/Lib/test/test_hash.py b/Lib/test/test_hash.py index 385efed7b3dd..3de3e8d0624f 100644 --- a/Lib/test/test_hash.py +++ b/Lib/test/test_hash.py @@ -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_