By default, != returns the opposite of ==, unless the latter returns
NotImplemented.
(Is this worth backporting to 2.6? It seems so useful...!)
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 @@
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)