[Python-checkins] python/nondist/sandbox/setuptools/setuptools/tests test_resources.py, 1.11, 1.12

pje@users.sourceforge.net pje at users.sourceforge.net
Sun Jun 5 20:59:39 CEST 2005


Update of /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/tests
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21981/setuptools/tests

Modified Files:
	test_resources.py 
Log Message:
Add "safe_name" and "safe_version" functions to allow sanitizing of
distribution names and versions in arbitrary packages that might be built
using EasyInstall.


Index: test_resources.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/tests/test_resources.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- test_resources.py	5 Jun 2005 01:20:09 -0000	1.11
+++ test_resources.py	5 Jun 2005 18:59:37 -0000	1.12
@@ -319,13 +319,20 @@
         )
         self.assertRaises(ValueError,list,pkg_resources.split_sections("[foo"))
 
+    def testSafeName(self):
+        self.assertEqual(safe_name("adns-python"), "adns-python")
+        self.assertEqual(safe_name("WSGI Utils"),  "WSGI-Utils")
+        self.assertEqual(safe_name("WSGI  Utils"), "WSGI-Utils")
+        self.assertEqual(safe_name("Money$$$Maker"), "Money-Maker")
+        self.assertEqual(safe_name("peak.web"), "peak-web")
 
-
-
-
-
-
-
+    def testSafeVersion(self):
+        self.assertEqual(safe_version("1.2-1"), "1.2-1")
+        self.assertEqual(safe_version("1.2 alpha"),  "1.2.alpha")
+        self.assertEqual(safe_version("2.3.4 20050521"), "2.3.4.20050521")
+        self.assertEqual(safe_version("Money$$$Maker"), "Money-Maker")
+        self.assertEqual(safe_version("peak.web"), "peak.web")
+        
     def testSimpleRequirements(self):
         self.assertEqual(
             list(parse_requirements('Twis-Ted>=1.2-1')),
@@ -358,14 +365,7 @@
         c('0pre1', '0.0c1')
         c('0.0.0preview1', '0c1')
         c('0.0c1', '0rc1')
-
-
-
-
-
-
-
-
+        c('1.2a1', '1.2.a.1'); c('1.2...a', '1.2a')
 
     def testVersionOrdering(self):
         def c(s1,s2):



More information about the Python-checkins mailing list