]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Add a test that memoryviews have hash randomization enabled.
authorAntoine Pitrou <solipsis@pitrou.net>
Tue, 21 Feb 2012 18:14:26 +0000 (19:14 +0100)
committerAntoine Pitrou <solipsis@pitrou.net>
Tue, 21 Feb 2012 18:14:26 +0000 (19:14 +0100)
Lib/test/test_hash.py

index 385efed7b3dd371ccdc0eb645e0ce6d18763cf9f..3de3e8d0624fee11ca59be31515b835c8ef68862 100644 (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_