summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_sets.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2003-09-24 03:56:07 (GMT)
committerRaymond Hettinger <python@rcn.com>2003-09-24 03:56:07 (GMT)
commit3778f40389e27313c34ff539d33fe9304754a9c2 (patch)
treebb3c577ec6b9c6c6dc0ca320372478a515bd0963 /Lib/test/test_sets.py
parentfd95c3a46688a643970c98349306d5f3389853fa (diff)
downloadcpython-3778f40389e27313c34ff539d33fe9304754a9c2.zip
cpython-3778f40389e27313c34ff539d33fe9304754a9c2.tar.gz
cpython-3778f40389e27313c34ff539d33fe9304754a9c2.tar.bz2
Add more identity tests.
Diffstat (limited to 'Lib/test/test_sets.py')
-rw-r--r--Lib/test/test_sets.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_sets.py b/Lib/test/test_sets.py
index 1b26d4c..9cc586f 100644
--- a/Lib/test/test_sets.py
+++ b/Lib/test/test_sets.py
@@ -732,6 +732,16 @@ class TestIdentities(unittest.TestCase):
if a != b:
self.assertNotEqual(a-b, b-a)
+ def test_reflexsive_relations(self):
+ a, zero = self.a, Set()
+ self.assertEqual(a ^ a, zero)
+ self.assertEqual(a - a, zero)
+ self.assertEqual(a | a, a)
+ self.assertEqual(a & a, a)
+ self.assert_(a <= a)
+ self.assert_(a >= a)
+ self.assert_(a == a)
+
def test_summations(self):
# check that sums of parts equal the whole
a, b = self.a, self.b
@@ -756,6 +766,7 @@ class TestIdentities(unittest.TestCase):
self.assertEqual(len(b), len(b-a) + len(a&b))
self.assertEqual(len(a^b), len(a-b) + len(b-a))
self.assertEqual(len(a|b), len(a-b) + len(a&b) + len(b-a))
+ self.assertEqual(len(a^b) + len(a&b), len(a|b))
#==============================================================================