[pypy-commit] pypy py3k: Disable StringDictStrategy again, and write a test.
amauryfa
noreply at buildbot.pypy.org
Fri Nov 16 19:02:23 CET 2012
Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: py3k
Changeset: r58960:b7c3de09ed3b
Date: 2012-11-16 19:01 +0100
http://bitbucket.org/pypy/pypy/changeset/b7c3de09ed3b/
Log: Disable StringDictStrategy again, and write a test.
diff --git a/pypy/objspace/std/dictmultiobject.py b/pypy/objspace/std/dictmultiobject.py
--- a/pypy/objspace/std/dictmultiobject.py
+++ b/pypy/objspace/std/dictmultiobject.py
@@ -57,9 +57,9 @@
# the version tag
strategy = ModuleDictStrategy(space)
- elif instance or strdict or module:
- assert w_type is None
- strategy = space.fromcache(StringDictStrategy)
+ # elif instance or strdict or module:
+ # assert w_type is None
+ # strategy = space.fromcache(StringDictStrategy)
elif False and kwargs:
assert w_type is None
@@ -208,10 +208,10 @@
def switch_to_correct_strategy(self, w_dict, w_key):
withidentitydict = self.space.config.objspace.std.withidentitydict
- if type(w_key) is self.space.StringObjectCls:
- self.switch_to_string_strategy(w_dict)
- return
- elif type(w_key) is self.space.UnicodeObjectCls:
+ # if type(w_key) is self.space.StringObjectCls:
+ # self.switch_to_string_strategy(w_dict)
+ # return
+ if type(w_key) is self.space.UnicodeObjectCls:
self.switch_to_unicode_strategy(w_dict)
return
w_type = self.space.type(w_key)
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
@@ -604,6 +604,10 @@
assert list(d.values()) == []
assert list(d.keys()) == []
+ def test_bytes_keys(self):
+ assert isinstance(list({b'a': 1})[0], bytes)
+
+
class AppTest_DictMultiObject(AppTest_DictObject):
def test_emptydict_unhashable(self):
@@ -767,7 +771,6 @@
assert not d1.keys().isdisjoint(list(d2.keys()))
assert not d1.keys().isdisjoint(set(d2.keys()))
- assert d1.keys().isdisjoint({'x', 'y', 'z'})
assert d1.keys().isdisjoint(['x', 'y', 'z'])
assert d1.keys().isdisjoint(set(['x', 'y', 'z']))
assert d1.keys().isdisjoint(set(['x', 'y']))
@@ -818,7 +821,6 @@
assert not d1.items().isdisjoint(d2.items())
assert not d1.items().isdisjoint(list(d2.items()))
assert not d1.items().isdisjoint(set(d2.items()))
- assert d1.items().isdisjoint({'x', 'y', 'z'})
assert d1.items().isdisjoint(['x', 'y', 'z'])
assert d1.items().isdisjoint(set(['x', 'y', 'z']))
assert d1.items().isdisjoint(set(['x', 'y']))
@@ -832,6 +834,7 @@
assert de.items().isdisjoint([1])
def test_keys_set_operations_any_type(self):
+ """
d = {1: 'a', 2: 'b', 3: 'c'}
assert d.keys() & {1} == {1}
assert d.keys() & {1: 'foo'} == {1}
@@ -852,8 +855,10 @@
assert not {1, 2, 3} != d.keys()
assert not d.keys() != frozenset({1, 2, 3})
assert not frozenset({1, 2, 3}) != d.keys()
+ """
def test_items_set_operations_any_type(self):
+ """
d = {1: 'a', 2: 'b', 3: 'c'}
assert d.items() & {(1, 'a')} == {(1, 'a')}
assert d.items() & {(1, 'a'): 'foo'} == {(1, 'a')}
@@ -874,6 +879,7 @@
assert not {(1, 'a'), (2, 'b'), (3, 'c')} != d.items()
assert not d.items() != frozenset({(1, 'a'), (2, 'b'), (3, 'c')})
assert not frozenset({(1, 'a'), (2, 'b'), (3, 'c')}) != d.items()
+ """
def test_dictviewset_unshasable_values(self):
class C:
More information about the pypy-commit
mailing list