summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_compare.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-03-27 22:37:34 (GMT)
committerGuido van Rossum <guido@python.org>2007-03-27 22:37:34 (GMT)
commite27dc7230845aa341d9a0bf323fa14912713cf33 (patch)
tree80e5451f5dac1bc5ac01ee3b70eaf9aff0461f31 /Lib/test/test_compare.py
parenta4335b1e6bc357fb6a3d54298e74a1d957028bc3 (diff)
downloadcpython-e27dc7230845aa341d9a0bf323fa14912713cf33.zip
cpython-e27dc7230845aa341d9a0bf323fa14912713cf33.tar.gz
cpython-e27dc7230845aa341d9a0bf323fa14912713cf33.tar.bz2
By default, != returns the opposite of ==, unless the latter returns
NotImplemented. (Is this worth backporting to 2.6? It seems so useful...!)
Diffstat (limited to 'Lib/test/test_compare.py')
-rw-r--r--Lib/test/test_compare.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_compare.py b/Lib/test/test_compare.py
index 1d0da69..c660837 100644
--- a/Lib/test/test_compare.py
+++ b/Lib/test/test_compare.py
@@ -39,6 +39,12 @@ class ComparisonTest(unittest.TestCase):
self.assertEqual(a == b, id(a) == id(b),
'a=%r, b=%r' % (a, b))
+ def test_ne_defaults_to_not_eq(self):
+ a = Cmp(1)
+ b = Cmp(1)
+ self.assertTrue(a == b)
+ self.assertFalse(a != b)
+
def test_main():
test_support.run_unittest(ComparisonTest)