SF 643115: Set._update() had a special case for dictionaries which allowed

non-true values to leak in.  This threw-off equality testing which depends
on the underlying dictionaries having both the same keys and values.
This commit is contained in:
Raymond Hettinger 2002-11-25 20:43:55 +00:00
parent 919000e9ec
commit 35e48d2426
2 changed files with 3 additions and 3 deletions

View File

@ -315,9 +315,6 @@ class BaseSet(object):
if isinstance(iterable, BaseSet): if isinstance(iterable, BaseSet):
data.update(iterable._data) data.update(iterable._data)
return return
if isinstance(iterable, dict):
data.update(iterable)
return
value = True value = True

View File

@ -179,6 +179,9 @@ class TestBinaryOps(unittest.TestCase):
def setUp(self): def setUp(self):
self.set = Set((2, 4, 6)) 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): def test_union_subset(self):
result = self.set | Set([2]) result = self.set | Set([2])
self.assertEqual(result, Set((2, 4, 6))) self.assertEqual(result, Set((2, 4, 6)))