[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [stem/master] Fix Version to match . strictly



commit 27e3806d4f37f47965c3237083d885db147faee7
Author: Ravi Chandra Padmala <neenaoffline@xxxxxxxxx>
Date:   Sun Mar 25 22:50:55 2012 +0530

    Fix Version to match . strictly
---
 stem/version.py      |    2 +-
 test/unit/version.py |    1 +
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/stem/version.py b/stem/version.py
index 12d12c9..350eceb 100644
--- a/stem/version.py
+++ b/stem/version.py
@@ -92,7 +92,7 @@ class Version:
     """
     
     self.version_str = version_str
-    m = re.match(r'^([0-9]+).([0-9]+).([0-9]+)(.[0-9]+)?(-.*)?$', version_str)
+    m = re.match(r'^([0-9]+)\.([0-9]+)\.([0-9]+)(\.[0-9]+)?(-.*)?$', version_str)
     
     if m:
       major, minor, micro, patch, status = m.groups()
diff --git a/test/unit/version.py b/test/unit/version.py
index df9e693..ab255d2 100644
--- a/test/unit/version.py
+++ b/test/unit/version.py
@@ -60,6 +60,7 @@ class TestVersion(unittest.TestCase):
     self.assertRaises(ValueError, stem.version.Version, "1.2.3.4nodash")
     self.assertRaises(ValueError, stem.version.Version, "1.2.3.a")
     self.assertRaises(ValueError, stem.version.Version, "1.2.a.4")
+    self.assertRaises(ValueError, stem.version.Version, "1x2x3x4")
     self.assertRaises(ValueError, stem.version.Version, "12.3")
     self.assertRaises(ValueError, stem.version.Version, "1.-2.3")
   



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits