[Python-checkins]
python/nondist/sandbox/setuptools/setuptools/tests
test_resources.py, 1.1, 1.2
pje at users.sourceforge.net
pje at users.sourceforge.net
Sun Apr 3 01:31:32 CEST 2005
Update of /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/tests
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22724/setuptools/tests
Modified Files:
test_resources.py
Log Message:
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.
Index: test_resources.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/tests/test_resources.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- test_resources.py 2 Apr 2005 02:43:21 -0000 1.1
+++ test_resources.py 2 Apr 2005 23:31:13 -0000 1.2
@@ -31,3 +31,61 @@
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')
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
More information about the Python-checkins
mailing list