Author: Philip Jenvey <pjen...@underboss.org> Branch: py3k Changeset: r83696:93e3beb469e2 Date: 2016-04-15 16:33 -0700 http://bitbucket.org/pypy/pypy/changeset/93e3beb469e2/
Log: reapply test_hash skips from ce0cdf69b07a diff --git a/lib-python/3/test/test_hash.py b/lib-python/3/test/test_hash.py --- a/lib-python/3/test/test_hash.py +++ b/lib-python/3/test/test_hash.py @@ -8,6 +8,7 @@ import sys import unittest from test.script_helper import assert_python_ok +from test.support import impl_detail, check_impl_detail from collections import Hashable IS_64BIT = sys.maxsize > 2**32 @@ -140,6 +141,7 @@ def get_hash_command(self, repr_): return 'print(hash(eval(%a)))' % repr_ + @impl_detail("PyPy does not support hash randomization", pypy=False) def get_hash(self, repr_, seed=None): env = os.environ.copy() env['__cleanenv'] = True # signal to assert_python not to do a copy @@ -161,6 +163,11 @@ self.assertNotEqual(run1, run2) class StringlikeHashRandomizationTests(HashRandomizationTests): + if check_impl_detail(pypy=True): + EMPTY_STRING_HASH = -1 + else: + EMPTY_STRING_HASH = 0 + def test_null_hash(self): # PYTHONHASHSEED=0 disables the randomized hash if IS_64BIT: @@ -194,21 +201,21 @@ repr_ = repr('abc') def test_empty_string(self): - self.assertEqual(hash(""), 0) + self.assertEqual(hash(""), self.EMPTY_STRING_HASH) class BytesHashRandomizationTests(StringlikeHashRandomizationTests, unittest.TestCase): repr_ = repr(b'abc') def test_empty_string(self): - self.assertEqual(hash(b""), 0) + self.assertEqual(hash(b""), self.EMPTY_STRING_HASH) class MemoryviewHashRandomizationTests(StringlikeHashRandomizationTests, unittest.TestCase): repr_ = "memoryview(b'abc')" def test_empty_string(self): - self.assertEqual(hash(memoryview(b"")), 0) + self.assertEqual(hash(memoryview(b"")), self.EMPTY_STRING_HASH) class DatetimeTests(HashRandomizationTests): def get_hash_command(self, repr_): _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit