summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2012-02-21 18:14:26 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2012-02-21 18:14:26 (GMT)
commit07c65884c635f1d4ea8f5fa8598d4dd091804aba (patch)
tree78670ece0b84374c832840cf9115a2f6ffd8b185 /Lib
parent528b54b2637ca2a0d96f1b597d50aa24f789e303 (diff)
downloadcpython-07c65884c635f1d4ea8f5fa8598d4dd091804aba.zip
cpython-07c65884c635f1d4ea8f5fa8598d4dd091804aba.tar.gz
cpython-07c65884c635f1d4ea8f5fa8598d4dd091804aba.tar.bz2
Add a test that memoryviews have hash randomization enabled.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_hash.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_hash.py b/Lib/test/test_hash.py
index 385efed..3de3e8d 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_