[pypy-svn] r78289 - in pypy/branch/set-object-cleanup/pypy/objspace/std: . test

arigo at codespeak.net arigo at codespeak.net
Tue Oct 26 13:45:02 CEST 2010


Author: arigo
Date: Tue Oct 26 13:45:01 2010
New Revision: 78289

Modified:
   pypy/branch/set-object-cleanup/pypy/objspace/std/setobject.py
   pypy/branch/set-object-cleanup/pypy/objspace/std/test/test_setobject.py
Log:
Test and fixes.


Modified: pypy/branch/set-object-cleanup/pypy/objspace/std/setobject.py
==============================================================================
--- pypy/branch/set-object-cleanup/pypy/objspace/std/setobject.py	(original)
+++ pypy/branch/set-object-cleanup/pypy/objspace/std/setobject.py	Tue Oct 26 13:45:01 2010
@@ -572,9 +572,9 @@
 
 
 def set_union__Set_ANY(space, w_left, w_other):
-    ld = w_left.setdata()
+    ld = w_left.setdata
     result = ld.copy()
-    for w_key in space.viewlist(w_other):
+    for w_key in space.listview(w_other):
         result[w_key] = None
     return w_left._newobj(space, result)
 

Modified: pypy/branch/set-object-cleanup/pypy/objspace/std/test/test_setobject.py
==============================================================================
--- pypy/branch/set-object-cleanup/pypy/objspace/std/test/test_setobject.py	(original)
+++ pypy/branch/set-object-cleanup/pypy/objspace/std/test/test_setobject.py	Tue Oct 26 13:45:01 2010
@@ -57,6 +57,11 @@
         b = a | set('abc')
         assert type(b) is subset
 
+    def test_union(self):
+        a = set([4, 5])
+        b = a.union([5, 7])
+        assert sorted(b) == [4, 5, 7]
+
     def test_compare(self):
         raises(TypeError, cmp, set('abc'), set('abd'))
         assert set('abc') != 'abc'



More information about the Pypy-commit mailing list