Author: Devin Jeanpierre <[email protected]>
Branch: cpyext-test-A
Changeset: r84078:1b3b372c1d9c
Date: 2016-04-30 22:42 -0700
http://bitbucket.org/pypy/pypy/changeset/1b3b372c1d9c/
Log: Fix test_hash to deal with lazily-created ->hash on CPython.
diff --git a/pypy/module/cpyext/test/test_unicodeobject.py
b/pypy/module/cpyext/test/test_unicodeobject.py
--- a/pypy/module/cpyext/test/test_unicodeobject.py
+++ b/pypy/module/cpyext/test/test_unicodeobject.py
@@ -85,8 +85,11 @@
'''
),
])
- res = module.test_hash(u"xyz")
- assert res == hash(u'xyz')
+ obj = u'xyz'
+ # CPython in particular does not precompute ->hash, so we need to call
+ # hash() first.
+ expected_hash = hash(obj)
+ assert module.test_hash(obj) == expected_hash
def test_default_encoded_string(self):
module = self.import_extension('foo', [
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit