[asterisk-commits] russell: testsuite/asterisk/trunk r88 - /asterisk/trunk/asteriskversion.py
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Mar 17 16:30:24 CDT 2010
Author: russell
Date: Wed Mar 17 16:30:21 2010
New Revision: 88
URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=88
Log:
Allow for just a major version like "1.4", and add a test case
Modified:
asterisk/trunk/asteriskversion.py
Modified: asterisk/trunk/asteriskversion.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/asteriskversion.py?view=diff&rev=88&r1=87&r2=88
==============================================================================
--- asterisk/trunk/asteriskversion.py (original)
+++ asterisk/trunk/asteriskversion.py Wed Mar 17 16:30:21 2010
@@ -35,9 +35,11 @@
parts = self.version_str.split(".")
self.concept = parts[0]
self.major = parts[1]
- self.minor = parts[2]
- if len(parts) > 3:
+ try:
+ self.minor = parts[2]
self.patch = parts[3]
+ except:
+ pass
def __parse_svn_version(self):
self.svn = True
@@ -88,6 +90,13 @@
self.assertEqual(v.minor, "30")
self.assertEqual(v.patch, "1")
+ def test_version3(self):
+ v = AsteriskVersion("1.4")
+ self.assertFalse(v.svn)
+ self.assertEqual(str(v), "1.4")
+ self.assertEqual(v.concept, "1")
+ self.assertEqual(v.major, "4")
+
def test_svn_version(self):
v = AsteriskVersion("SVN-trunk-r252849")
self.assertTrue(v.svn)
More information about the asterisk-commits
mailing list