diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2018-09-04 12:04:25 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-04 12:04:25 (GMT) |
commit | 7917aadb3edb7616d6164c5eaba24df6ac0a5fc6 (patch) | |
tree | 5df1672b1047a1bc44a9ee51ca48340c0acc82d1 | |
parent | 39487196c87e28128ea907a0d9b8a88ba53f68d5 (diff) | |
download | cpython-7917aadb3edb7616d6164c5eaba24df6ac0a5fc6.zip cpython-7917aadb3edb7616d6164c5eaba24df6ac0a5fc6.tar.gz cpython-7917aadb3edb7616d6164c5eaba24df6ac0a5fc6.tar.bz2 |
bpo-26544: Add test for platform._comparable_version(). (GH-8973)
-rw-r--r-- | Lib/test/test_platform.py | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/Lib/test/test_platform.py b/Lib/test/test_platform.py index 9ecd5d9..fd6da31 100644 --- a/Lib/test/test_platform.py +++ b/Lib/test/test_platform.py @@ -275,6 +275,42 @@ class PlatformTest(unittest.TestCase): self.assertEqual(platform.libc_ver(support.TESTFN), ('glibc', '1.23.4')) + @support.cpython_only + def test__comparable_version(self): + from platform import _comparable_version as V + self.assertEqual(V('1.2.3'), V('1.2.3')) + self.assertLess(V('1.2.3'), V('1.2.10')) + self.assertEqual(V('1.2.3.4'), V('1_2-3+4')) + self.assertLess(V('1.2spam'), V('1.2dev')) + self.assertLess(V('1.2dev'), V('1.2alpha')) + self.assertLess(V('1.2dev'), V('1.2a')) + self.assertLess(V('1.2alpha'), V('1.2beta')) + self.assertLess(V('1.2a'), V('1.2b')) + self.assertLess(V('1.2beta'), V('1.2c')) + self.assertLess(V('1.2b'), V('1.2c')) + self.assertLess(V('1.2c'), V('1.2RC')) + self.assertLess(V('1.2c'), V('1.2rc')) + self.assertLess(V('1.2RC'), V('1.2.0')) + self.assertLess(V('1.2rc'), V('1.2.0')) + self.assertLess(V('1.2.0'), V('1.2pl')) + self.assertLess(V('1.2.0'), V('1.2p')) + + self.assertLess(V('1.5.1'), V('1.5.2b2')) + self.assertLess(V('3.10a'), V('161')) + self.assertEqual(V('8.02'), V('8.02')) + self.assertLess(V('3.4j'), V('1996.07.12')) + self.assertLess(V('3.1.1.6'), V('3.2.pl0')) + self.assertLess(V('2g6'), V('11g')) + self.assertLess(V('0.9'), V('2.2')) + self.assertLess(V('1.2'), V('1.2.1')) + self.assertLess(V('1.1'), V('1.2.2')) + self.assertLess(V('1.1'), V('1.2')) + self.assertLess(V('1.2.1'), V('1.2.2')) + self.assertLess(V('1.2'), V('1.2.2')) + self.assertLess(V('0.4'), V('0.4.0')) + self.assertLess(V('1.13++'), V('5.5.kw')) + self.assertLess(V('0.960923'), V('2.2beta29')) + def test_popen(self): mswindows = (sys.platform == "win32") |