Commits

Philip Jenvey  committed a0becb7 Merge

merge py3k

  • Participants
  • Parent commits a98806e, f10a4d4
  • Branches py3k-fix-strategies

Comments (0)

Files changed (2)

File pypy/objspace/std/test/test_celldict.py

 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)

File pypy/objspace/std/test/test_dictmultiobject.py

                 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
         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):