diff options
| author | PJ Eby <distutils-sig@python.org> | 2005-04-02 23:31:13 +0000 |
|---|---|---|
| committer | PJ Eby <distutils-sig@python.org> | 2005-04-02 23:31:13 +0000 |
| commit | 1a7cff662b734fed26360983b961ce70b889767e (patch) | |
| tree | 0bff50cfc0edbe9277ce37cb3dfd296223450600 /setuptools/tests/test_resources.py | |
| parent | 6d3753cc8d96814a99cedd8a24a57977e5ef7766 (diff) | |
| download | python-setuptools-git-1a7cff662b734fed26360983b961ce70b889767e.tar.gz | |
Add a simple version parser that combines the pre-release smarts of
distutils' StrictVersion, with the flexibility of LooseVersion. It also
deals heuristically with common concepts like alpha/beta/candidate/rc
and pre/preview, as well as '-' and 'pl' branching schemes.
--HG--
branch : setuptools
extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/trunk/setuptools%4041000
Diffstat (limited to 'setuptools/tests/test_resources.py')
| -rw-r--r-- | setuptools/tests/test_resources.py | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/setuptools/tests/test_resources.py b/setuptools/tests/test_resources.py index f918d21b..8797cda9 100644 --- a/setuptools/tests/test_resources.py +++ b/setuptools/tests/test_resources.py @@ -31,3 +31,61 @@ class ParseTests(TestCase): self.assertRaises(ValueError,lambda:list(parse_requirements("x\\"))) self.assertRaises(ValueError,lambda:list(parse_requirements("x==2 q"))) + + + + + + + + + def testVersionOrdering(self): + def c(s1,s2): + p1, p2 = parse_version(s1),parse_version(s2) + self.failUnless(p1<p2, (s1,s2,p1,p2)) + + c('2.1','2.1.1') + c('2a1','2b0') + c('2a1','2.1') + c('2.3a1', '2.3') + c('2.1-1', '2.1-2') + c('2.1-1', '2.1.1') + c('2.1', '2.1pl4') + c('2.1a0-20040501', '2.1') + c('1.1', '02.1') + c('A56','B27') + c('3.2', '3.2.pl0') + c('3.2-1', '3.2pl1') + c('3.2pl1', '3.2pl1-1') + c('0.4', '4.0') + c('0.0.4', '0.4.0') + c('0pl1', '0.4pl1') + + + def testVersionEquality(self): + def c(s1,s2): + p1, p2 = parse_version(s1),parse_version(s2) + self.assertEqual(p1,p2, (s1,s2,p1,p2)) + + c('0.4', '0.4.0') + c('0.4.0.0', '0.4.0') + c('0.4.0-0', '0.4-0') + c('0pl1', '0.0pl1') + c('0pre1', '0.0c1') + c('0.0.0preview1', '0c1') + c('0.0c1', '0rc1') + + + + + + + + + + + + + + + |
