[pypy-commit] pypy py3k: test&fix for the only set operator which is not symmetric

antocuni noreply at buildbot.pypy.org
Tue Oct 2 16:01:35 CEST 2012


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: py3k
Changeset: r57717:3110468abb0a
Date: 2012-10-02 14:56 +0200
http://bitbucket.org/pypy/pypy/changeset/3110468abb0a/

Log:	test&fix for the only set operator which is not symmetric

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
@@ -1022,8 +1022,8 @@
             return w_set
 
         def {opname}__ANY_DictViewKeys(space, w_other, w_dictview):
-            w_set = space.call_function(space.w_set, w_dictview)
-            space.call_method(w_set, '{methodname}', w_other)
+            w_set = space.call_function(space.w_set, w_other)
+            space.call_method(w_set, '{methodname}', w_dictview)
             return w_set
 
         {opname}__DictViewItems_ANY = {opname}__DictViewKeys_ANY
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
@@ -793,6 +793,9 @@
         assert {1} & d.keys() == {1}
         assert {1: 'foo'} & d.keys() == {1}
         assert [1, 2] & d.keys() == {1, 2}
+        #
+        assert d.keys() - {1} == {2, 3}
+        assert {1, 4} - d.keys() == {4}
         
 class AppTestStrategies(object):
     def setup_class(cls):


More information about the pypy-commit mailing list