[pypy-commit] pypy py3k-fix-strategies: merge py3k

pjenvey noreply at buildbot.pypy.org
Fri Apr 18 02:43:09 CEST 2014


Author: Philip Jenvey <pjenvey at underboss.org>
Branch: py3k-fix-strategies
Changeset: r70735:a0becb7c56be
Date: 2014-04-17 16:53 -0700
http://bitbucket.org/pypy/pypy/changeset/a0becb7c56be/

Log:	merge py3k

diff --git a/pypy/objspace/std/test/test_celldict.py b/pypy/objspace/std/test/test_celldict.py
--- a/pypy/objspace/std/test/test_celldict.py
+++ b/pypy/objspace/std/test/test_celldict.py
@@ -1,42 +1,47 @@
 import py
+
+from pypy.objspace.std.celldict import ModuleDictStrategy
 from pypy.objspace.std.dictmultiobject import W_DictMultiObject
-from pypy.objspace.std.celldict import ModuleCell, ModuleDictStrategy
-from pypy.objspace.std.test.test_dictmultiobject import FakeSpace, \
-        BaseTestRDictImplementation, BaseTestDevolvedDictImplementation
-from pypy.interpreter import gateway
+from pypy.objspace.std.test.test_dictmultiobject import (
+    BaseTestRDictImplementation, BaseTestDevolvedDictImplementation, FakeSpace,
+    FakeString)
 
 space = FakeSpace()
 
 class TestCellDict(object):
+    FakeString = FakeString
+
     def test_basic_property_cells(self):
         strategy = ModuleDictStrategy(space)
         storage = strategy.get_empty_storage()
         d = W_DictMultiObject(space, strategy, storage)
 
         v1 = strategy.version
-        d.setitem("a", 1)
+        key = "a"
+        w_key = self.FakeString(key)
+        d.setitem(w_key, 1)
         v2 = strategy.version
         assert v1 is not v2
-        assert d.getitem("a") == 1
-        assert d.strategy.getdictvalue_no_unwrapping(d, "a") == 1
+        assert d.getitem(w_key) == 1
+        assert d.strategy.getdictvalue_no_unwrapping(d, key) == 1
 
-        d.setitem("a", 2)
+        d.setitem(w_key, 2)
         v3 = strategy.version
         assert v2 is not v3
-        assert d.getitem("a") == 2
-        assert d.strategy.getdictvalue_no_unwrapping(d, "a").w_value == 2
+        assert d.getitem(w_key) == 2
+        assert d.strategy.getdictvalue_no_unwrapping(d, key).w_value == 2
 
-        d.setitem("a", 3)
+        d.setitem(w_key, 3)
         v4 = strategy.version
         assert v3 is v4
-        assert d.getitem("a") == 3
-        assert d.strategy.getdictvalue_no_unwrapping(d, "a").w_value == 3
+        assert d.getitem(w_key) == 3
+        assert d.strategy.getdictvalue_no_unwrapping(d, key).w_value == 3
 
-        d.delitem("a")
+        d.delitem(w_key)
         v5 = strategy.version
         assert v5 is not v4
-        assert d.getitem("a") is None
-        assert d.strategy.getdictvalue_no_unwrapping(d, "a") is None
+        assert d.getitem(w_key) is None
+        assert d.strategy.getdictvalue_no_unwrapping(d, key) is None
 
     def test_same_key_set_twice(self):
         strategy = ModuleDictStrategy(space)
diff --git a/pypy/objspace/std/test/test_dictmultiobject.py b/pypy/objspace/std/test/test_dictmultiobject.py
--- a/pypy/objspace/std/test/test_dictmultiobject.py
+++ b/pypy/objspace/std/test/test_dictmultiobject.py
@@ -1293,12 +1293,13 @@
                 return other == "s"
 
         d = self.get_impl()
-        d.setitem("s", 12)
-        assert d.getitem("s") == 12
-        assert d.getitem(F()) == d.getitem("s")
+        w_key = FakeString("s")
+        d.setitem(w_key, 12)
+        assert d.getitem(w_key) == 12
+        assert d.getitem(F()) == d.getitem(w_key)
 
         d = self.get_impl()
-        x = d.setdefault("s", 12)
+        x = d.setdefault(w_key, 12)
         assert x == 12
         x = d.setdefault(F(), 12)
         assert x == 12
@@ -1308,10 +1309,10 @@
         assert x == 12
 
         d = self.get_impl()
-        d.setitem("s", 12)
+        d.setitem(w_key, 12)
         d.delitem(F())
 
-        assert "s" not in d.w_keys()
+        assert w_key not in d.w_keys()
         assert F() not in d.w_keys()
 
 class TestUnicodeDictImplementation(BaseTestRDictImplementation):


More information about the pypy-commit mailing list