[pypy-svn] r49239 - pypy/dist/pypy/translator/c/test
arigo at codespeak.net
arigo at codespeak.net
Sat Dec 1 11:25:57 CET 2007
Author: arigo
Date: Sat Dec 1 11:25:57 2007
New Revision: 49239
Modified:
pypy/dist/pypy/translator/c/test/test_typed.py
Log:
Port of r49238.
Modified: pypy/dist/pypy/translator/c/test/test_typed.py
==============================================================================
--- pypy/dist/pypy/translator/c/test/test_typed.py (original)
+++ pypy/dist/pypy/translator/c/test/test_typed.py Sat Dec 1 11:25:57 2007
@@ -573,6 +573,7 @@
assert f(255) == 255
def test_hash_preservation(self):
+ from pypy.rlib.objectmodel import current_object_addr_as_int
class C:
pass
class D(C):
@@ -581,16 +582,16 @@
d = D()
def fn():
d2 = D()
- # xxx check for this CPython peculiarity for now:
- x = (hash(d2) & sys.maxint) == (id(d2) & sys.maxint)
- return x, hash(c)+hash(d)
+ return hash(d2), current_object_addr_as_int(d2), hash(c), hash(d)
f = self.getcompiled(fn)
res = f()
- assert res[0] == True
- assert res[1] == intmask(hash(c)+hash(d))
+ # xxx this is too precise, checking the exact implementation
+ assert res[0] == ~res[1]
+ assert res[2] == hash(c)
+ assert res[3] == hash(d)
def test_list_basic_ops(self):
def list_basic_ops(i, j):
More information about the Pypy-commit
mailing list