diff options
author | Raymond Hettinger <python@rcn.com> | 2005-08-13 02:28:54 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2005-08-13 02:28:54 (GMT) |
commit | ab294199b772e47dd86ca665dbc1080715b844d2 (patch) | |
tree | 355e719f2cbc756be0d9c8a2943a9056cc304a77 /Lib/test/test_set.py | |
parent | 787b4c5fea8476a1146918f90a6da7f63d7aa31c (diff) | |
download | cpython-ab294199b772e47dd86ca665dbc1080715b844d2.zip cpython-ab294199b772e47dd86ca665dbc1080715b844d2.tar.gz cpython-ab294199b772e47dd86ca665dbc1080715b844d2.tar.bz2 |
Teach set modules to correctly compute s-=s and s^=s as the empty set.
Diffstat (limited to 'Lib/test/test_set.py')
-rw-r--r-- | Lib/test/test_set.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_set.py b/Lib/test/test_set.py index b4c7c4f..354db78 100644 --- a/Lib/test/test_set.py +++ b/Lib/test/test_set.py @@ -382,6 +382,18 @@ class TestSet(TestJointOps): else: self.assert_(c not in self.s) + def test_inplace_on_self(self): + t = self.s.copy() + t |= t + self.assertEqual(t, self.s) + t &= t + self.assertEqual(t, self.s) + t -= t + self.assertEqual(t, self.thetype()) + t = self.s.copy() + t ^= t + self.assertEqual(t, self.thetype()) + def test_weakref(self): s = self.thetype('gallahad') p = proxy(s) |