]> granicus.if.org Git - python/commitdiff
SF 643115: Set._update() had a special case for dictionaries which allowed
authorRaymond Hettinger <python@rcn.com>
Mon, 25 Nov 2002 20:43:55 +0000 (20:43 +0000)
committerRaymond Hettinger <python@rcn.com>
Mon, 25 Nov 2002 20:43:55 +0000 (20:43 +0000)
non-true values to leak in.  This threw-off equality testing which depends
on the underlying dictionaries having both the same keys and values.

Lib/sets.py
Lib/test/test_sets.py

index 5dac370a6447e0c52468be9382a4bdba67df5084..2605c98fd0982a9de6b986760b581397d00765d3 100644 (file)
@@ -315,9 +315,6 @@ class BaseSet(object):
         if isinstance(iterable, BaseSet):
             data.update(iterable._data)
             return
-        if isinstance(iterable, dict):
-            data.update(iterable)
-            return
 
         value = True
 
index 9bc3eeba748045e0d6cf7feba627ec49f277427b..f80d58e82ef2eaf966d8c829997c2fdf64e45f45 100644 (file)
@@ -179,6 +179,9 @@ class TestBinaryOps(unittest.TestCase):
     def setUp(self):
         self.set = Set((2, 4, 6))
 
+    def test_eq(self):              # SF bug 643115
+        self.assertEqual(self.set, Set({2:1,4:3,6:5}))
+
     def test_union_subset(self):
         result = self.set | Set([2])
         self.assertEqual(result, Set((2, 4, 6)))