Author: Philip Jenvey <[email protected]>
Branch: py3k
Changeset: r59341:ce0cdf69b07a
Date: 2012-12-05 17:13 -0800
http://bitbucket.org/pypy/pypy/changeset/ce0cdf69b07a/
Log: port test_hash skips from 2.7
diff --git a/lib-python/3.2/test/test_hash.py b/lib-python/3.2/test/test_hash.py
--- a/lib-python/3.2/test/test_hash.py
+++ b/lib-python/3.2/test/test_hash.py
@@ -8,6 +8,7 @@
import sys
import unittest
from test import support
+from test.support import impl_detail, check_impl_detail
from test.script_helper import assert_python_ok
from collections import Hashable
@@ -132,6 +133,7 @@
def get_hash_command(self, repr_):
return 'print(hash(%s))' % 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
@@ -153,6 +155,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:
@@ -185,13 +192,13 @@
repr_ = repr('abc')
def test_empty_string(self):
- self.assertEqual(hash(""), 0)
+ self.assertEqual(hash(""), self.EMPTY_STRING_HASH)
class BytesHashRandomizationTests(StringlikeHashRandomizationTests):
repr_ = repr(b'abc')
def test_empty_string(self):
- self.assertEqual(hash(b""), 0)
+ self.assertEqual(hash(b""), self.EMPTY_STRING_HASH)
class DatetimeTests(HashRandomizationTests):
def get_hash_command(self, repr_):
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit