Author: Antonio Cuni <[email protected]>
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):
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to