summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_compare.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2019-08-08 05:43:18 (GMT)
committerGitHub <noreply@github.com>2019-08-08 05:43:18 (GMT)
commit7d44e7a4563072d0fad00427b76b94cad61c38ae (patch)
tree3c5244b17e90529d6f10c8c54bfadf4caa31cb38 /Lib/test/test_compare.py
parent662db125cddbca1db68116c547c290eb3943d98e (diff)
downloadcpython-7d44e7a4563072d0fad00427b76b94cad61c38ae.zip
cpython-7d44e7a4563072d0fad00427b76b94cad61c38ae.tar.gz
cpython-7d44e7a4563072d0fad00427b76b94cad61c38ae.tar.bz2
bpo-37685: Use singletons ALWAYS_EQ and NEVER_EQ in more tests. (GH-15167)
Diffstat (limited to 'Lib/test/test_compare.py')
-rw-r--r--Lib/test/test_compare.py16
1 files changed, 5 insertions, 11 deletions
diff --git a/Lib/test/test_compare.py b/Lib/test/test_compare.py
index 471c8da..2b3faed 100644
--- a/Lib/test/test_compare.py
+++ b/Lib/test/test_compare.py
@@ -1,4 +1,5 @@
import unittest
+from test.support import ALWAYS_EQ
class Empty:
def __repr__(self):
@@ -14,13 +15,6 @@ class Cmp:
def __eq__(self, other):
return self.arg == other
-class Anything:
- def __eq__(self, other):
- return True
-
- def __ne__(self, other):
- return False
-
class ComparisonTest(unittest.TestCase):
set1 = [2, 2.0, 2, 2+0j, Cmp(2.0)]
set2 = [[1], (3,), None, Empty()]
@@ -113,11 +107,11 @@ class ComparisonTest(unittest.TestCase):
def test_issue_1393(self):
x = lambda: None
- self.assertEqual(x, Anything())
- self.assertEqual(Anything(), x)
+ self.assertEqual(x, ALWAYS_EQ)
+ self.assertEqual(ALWAYS_EQ, x)
y = object()
- self.assertEqual(y, Anything())
- self.assertEqual(Anything(), y)
+ self.assertEqual(y, ALWAYS_EQ)
+ self.assertEqual(ALWAYS_EQ, y)
if __name__ == '__main__':