Commits

tarek  committed 5c5755b

lowering the irrational versions to 3%

  • Participants
  • Parent commits 81f35a9

Comments (0)

Files changed (2)

File test_verlib.py

         self.assertEquals(suggest('2.4pre1') , '2.4c1')
         self.assertEquals(suggest('2.1-rc2'), '2.1c2')
 
+        # from pypi
+        self.assertEquals(suggest('0.1dev'), '0.1.dev0')
+        self.assertEquals(suggest('0.1.dev'), '0.1.dev0')
+
 def test_suite():
     #README = os.path.join(os.path.dirname(__file__), 'README.txt')
     #suite = [doctest.DocFileSuite(README), unittest.makeSuite(VersionTestCase)]
     # PyPI stats: ~21 (0.62%) better
     rs = re.sub(r"\.?(pre|preview|-c)(\d+)$", r"c\g<2>", rs)
 
+    # a terminal ".dev" can be changed into ".dev0"
+    rs = re.sub(r"[\.\-]dev$", r".dev0", rs)
+
+    # a terminal "dev" can be changed into ".dev0"
+    rs = re.sub(r"(?![\.\-])dev$", r".dev0", rs)
+
+    # a terminal "final" or "stable" can be removed
+    rs = re.sub(r"(final|stable)$", "", rs)
+
     try:
         NormalizedVersion(rs)
         return rs   # already rational