[pypy-svn] r51206 - in pypy/branch/jit-refactoring/pypy/jit/timeshifter: . test
cfbolz at codespeak.net
cfbolz at codespeak.net
Sat Feb 2 13:27:18 CET 2008
Author: cfbolz
Date: Sat Feb 2 13:27:17 2008
New Revision: 51206
Modified:
pypy/branch/jit-refactoring/pypy/jit/timeshifter/greenkey.py
pypy/branch/jit-refactoring/pypy/jit/timeshifter/test/test_greenkey.py
Log:
put a newgreendict function in the main file
Modified: pypy/branch/jit-refactoring/pypy/jit/timeshifter/greenkey.py
==============================================================================
--- pypy/branch/jit-refactoring/pypy/jit/timeshifter/greenkey.py (original)
+++ pypy/branch/jit-refactoring/pypy/jit/timeshifter/greenkey.py Sat Feb 2 13:27:17 2008
@@ -1,6 +1,7 @@
from pypy.rpython.annlowlevel import cachedtype
from pypy.rlib.rarithmetic import intmask
from pypy.rlib.unroll import unrolling_iterable
+from pypy.rlib.objectmodel import r_dict
from pypy.rpython.lltypesystem import lltype
class KeyDesc(object):
@@ -70,3 +71,7 @@
def greenkey_hash(self):
return self.desc.hash(self, self.rgenop)
+def newgreendict():
+ return r_dict(greenkey_eq, greenkey_hash)
+
+
Modified: pypy/branch/jit-refactoring/pypy/jit/timeshifter/test/test_greenkey.py
==============================================================================
--- pypy/branch/jit-refactoring/pypy/jit/timeshifter/test/test_greenkey.py (original)
+++ pypy/branch/jit-refactoring/pypy/jit/timeshifter/test/test_greenkey.py Sat Feb 2 13:27:17 2008
@@ -1,30 +1,26 @@
-from pypy.jit.timeshifter.greenkey import GreenKey, KeyDesc
+from pypy.jit.timeshifter.greenkey import GreenKey, KeyDesc, newgreendict
from pypy.jit.timeshifter.greenkey import greenkey_hash, greenkey_eq
from pypy.jit.codegen.llgraph.rgenop import RGenOp
-from pypy.rlib.objectmodel import r_dict
from pypy.rpython.lltypesystem import lltype
rgenop = RGenOp()
class TestGreenKeys(object):
- def newdict(self):
- return r_dict(greenkey_eq, greenkey_hash)
-
def newkey(self, *values):
desc = KeyDesc(RGenOp, *[lltype.typeOf(val) for val in values])
return GreenKey([rgenop.genconst(val) for val in values], desc, rgenop)
def test_simple(self):
- d = self.newdict()
+ d = newgreendict()
d[self.newkey(1, 2)] = 1
assert d[self.newkey(1, 2)] == 1
def test_check_types(self):
- d = self.newdict()
+ d = newgreendict()
d[self.newkey(1, 2)] = 1
assert self.newkey(True, 2) not in d
def test_check_lengths(self):
- d = self.newdict()
+ d = newgreendict()
d[self.newkey(1, 2)] = 1
assert self.newkey(1, 2, 0) not in d
More information about the Pypy-commit
mailing list