Author: Philip Jenvey <pjen...@underboss.org> Branch: py3k Changeset: r70734:f10a4d4b1837 Date: 2014-04-17 16:53 -0700 http://bitbucket.org/pypy/pypy/changeset/f10a4d4b1837/
Log: merge default 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 @@ -1274,12 +1274,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 @@ -1289,10 +1290,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 TestBytesDictImplementation(BaseTestRDictImplementation): _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit