diff options
author | Raymond Hettinger <python@rcn.com> | 2005-08-13 02:29:58 +0000 |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2005-08-13 02:29:58 +0000 |
commit | 038ca2a5516f6b445a8548f3999d1db3b6b8abb1 (patch) | |
tree | 3359f325b2eb27e8ed326bdac148d0de7ff62387 /Lib/test/test_sets.py | |
parent | f98e6b15bab7efb786ab65db63146afea388b022 (diff) | |
download | cpython-git-038ca2a5516f6b445a8548f3999d1db3b6b8abb1.tar.gz |
Teach the sets module to correctly compute s-=s and s^=s as the empty set.
Diffstat (limited to 'Lib/test/test_sets.py')
-rw-r--r-- | Lib/test/test_sets.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_sets.py b/Lib/test/test_sets.py index c5a48b1c1e..ff834e0aa0 100644 --- a/Lib/test/test_sets.py +++ b/Lib/test/test_sets.py @@ -243,6 +243,19 @@ class TestBinaryOps(unittest.TestCase): self.assertRaises(TypeError, cmp, a, 12) self.assertRaises(TypeError, cmp, "abc", a) + def test_inplace_on_self(self): + t = self.set.copy() + t |= t + self.assertEqual(t, self.set) + t &= t + self.assertEqual(t, self.set) + t -= t + self.assertEqual(len(t), 0) + t = self.set.copy() + t ^= t + self.assertEqual(len(t), 0) + + #============================================================================== class TestUpdateOps(unittest.TestCase): |