Commits

Lukas Diekmann committed 64ffc4b

fixed EmptySetStrategy.issuperset

  • Participants
  • Parent commits 14b4c0d
  • Branches set-strategies

Comments (0)

Files changed (2)

File pypy/objspace/std/setobject.py

         return True
 
     def issuperset(self, w_set, w_other):
-        if self.space.unwrap(self.space.len(w_other)) == 0:
+        if isinstance(w_other, W_BaseSetObject) and w_other.strategy is EmptySetStrategy:
+            return True
+        elif len(self.space.unpackiterable(w_other)) == 0:
             return True
         return False
 

File pypy/objspace/std/test/test_setobject.py

         assert e.issuperset(x) == False
         assert x.issuperset(e) == True
 
+        assert e.issuperset(set())
+        assert e.issuperset([])
+
     def test_empty_issubset(self):
         e = set()
         x = set([1,2,3])
         assert e.issubset(e) == True
         assert e.issubset(x) == True
         assert x.issubset(e) == False
+        assert e.issubset([])
 
     def test_empty_isdisjoint(self):
         e = set()