summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2019-08-08 08:42:54 +0300
committerGitHub <noreply@github.com>2019-08-08 08:42:54 +0300
commitcab8dd1a30b14542fcfe7ab63f8cd8b5358222da (patch)
tree9dfbd7f131eab0f63091b0180e9811dee4863109 /tests
parent3665ddcf056ef72aa6e8e92aee81684d146d5dde (diff)
downloadpython-setuptools-git-cab8dd1a30b14542fcfe7ab63f8cd8b5358222da.tar.gz
bpo-37685: Fixed __eq__, __lt__ etc implementations in some classes. (GH-14952)
They now return NotImplemented for unsupported type of the other operand.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_version.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/test_version.py b/tests/test_version.py
index 15f14c7d..8671cd2f 100644
--- a/tests/test_version.py
+++ b/tests/test_version.py
@@ -45,6 +45,14 @@ class VersionTestCase(unittest.TestCase):
self.assertEqual(res, wanted,
'cmp(%s, %s) should be %s, got %s' %
(v1, v2, wanted, res))
+ res = StrictVersion(v1)._cmp(v2)
+ self.assertEqual(res, wanted,
+ 'cmp(%s, %s) should be %s, got %s' %
+ (v1, v2, wanted, res))
+ res = StrictVersion(v1)._cmp(object())
+ self.assertIs(res, NotImplemented,
+ 'cmp(%s, %s) should be NotImplemented, got %s' %
+ (v1, v2, res))
def test_cmp(self):
@@ -63,6 +71,14 @@ class VersionTestCase(unittest.TestCase):
self.assertEqual(res, wanted,
'cmp(%s, %s) should be %s, got %s' %
(v1, v2, wanted, res))
+ res = LooseVersion(v1)._cmp(v2)
+ self.assertEqual(res, wanted,
+ 'cmp(%s, %s) should be %s, got %s' %
+ (v1, v2, wanted, res))
+ res = LooseVersion(v1)._cmp(object())
+ self.assertIs(res, NotImplemented,
+ 'cmp(%s, %s) should be NotImplemented, got %s' %
+ (v1, v2, res))
def test_suite():
return unittest.makeSuite(VersionTestCase)