diff options
| author | PJ Eby <distutils-sig@python.org> | 2005-06-05 18:59:37 +0000 |
|---|---|---|
| committer | PJ Eby <distutils-sig@python.org> | 2005-06-05 18:59:37 +0000 |
| commit | 0c9e886999bb42cf825054778b1664e41f8164b4 (patch) | |
| tree | c2b0f62ab2390372d3fe5ecb42f0246bf8e2abf5 /setuptools/tests/test_resources.py | |
| parent | 992e379c8850a2a23da24e5586799f7ba933e692 (diff) | |
| download | python-setuptools-git-0c9e886999bb42cf825054778b1664e41f8164b4.tar.gz | |
Add "safe_name" and "safe_version" functions to allow sanitizing of
distribution names and versions in arbitrary packages that might be built
using EasyInstall.
--HG--
branch : setuptools
extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/trunk/setuptools%4041040
Diffstat (limited to 'setuptools/tests/test_resources.py')
| -rw-r--r-- | setuptools/tests/test_resources.py | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/setuptools/tests/test_resources.py b/setuptools/tests/test_resources.py index f2a0d296..88b5f889 100644 --- a/setuptools/tests/test_resources.py +++ b/setuptools/tests/test_resources.py @@ -319,13 +319,20 @@ class ParseTests(TestCase): ) 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 @@ class ParseTests(TestCase): 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): |
