[Python-checkins] python/dist/src/Lib/test test_sets.py,1.31,1.32

rhettinger@users.sourceforge.net rhettinger at users.sourceforge.net
Sat Aug 13 04:30:07 CEST 2005


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3974/Lib/test

Modified Files:
	test_sets.py 
Log Message:
Teach the sets module to correctly compute s-=s and s^=s as the empty set.



Index: test_sets.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sets.py,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- test_sets.py	7 Aug 2004 06:15:12 -0000	1.31
+++ test_sets.py	13 Aug 2005 02:29:58 -0000	1.32
@@ -243,6 +243,19 @@
         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):



More information about the Python-checkins mailing list