diff options
-rw-r--r-- | semantic_version/base.py | 6 | ||||
-rwxr-xr-x | tests/test_match.py | 14 |
2 files changed, 18 insertions, 2 deletions
diff --git a/semantic_version/base.py b/semantic_version/base.py index deebbc9..d0f5db8 100644 --- a/semantic_version/base.py +++ b/semantic_version/base.py @@ -389,13 +389,15 @@ class SpecItem(object): KIND_LT = '<' KIND_LTE = '<=' KIND_EQUAL = '==' + KIND_SHORTEQ = '=' + KIND_EMPTY = '' KIND_GTE = '>=' KIND_GT = '>' KIND_NEQ = '!=' KIND_CARET = '^' KIND_TILDE = '~' - re_spec = re.compile(r'^(<|<=|==|>=|>|!=|\^|~)(\d.*)$') + re_spec = re.compile(r'^(<|<=|={,2}|>=|>|!=|\^|~)(\d.*)$') def __init__(self, requirement_string): kind, spec = self.parse(requirement_string) @@ -430,7 +432,7 @@ class SpecItem(object): return version < self.spec elif self.kind == self.KIND_LTE: return version <= self.spec - elif self.kind == self.KIND_EQUAL: + elif self.kind in [self.KIND_EQUAL, self.KIND_SHORTEQ, self.KIND_EMPTY]: return version == self.spec elif self.kind == self.KIND_GTE: return version >= self.spec diff --git a/tests/test_match.py b/tests/test_match.py index 73a2588..c4452d4 100755 --- a/tests/test_match.py +++ b/tests/test_match.py @@ -21,6 +21,8 @@ class MatchTestCase(unittest.TestCase): valid_specs = [ '*', '==0.1.0', + '=0.1.0', + '0.1.0', '<=0.1.1', '<0.1', '>0.1.2-rc1', @@ -49,6 +51,18 @@ class MatchTestCase(unittest.TestCase): '0.1.2+build42-12.2012-01-01.12h23', '0.1.2-rc1.3-14.15+build.2012-01-01.11h34', ], + '=0.1.2': [ + '0.1.2-rc1', + '0.1.2-rc1.3.4', + '0.1.2+build42-12.2012-01-01.12h23', + '0.1.2-rc1.3-14.15+build.2012-01-01.11h34', + ], + '0.1.2': [ + '0.1.2-rc1', + '0.1.2-rc1.3.4', + '0.1.2+build42-12.2012-01-01.12h23', + '0.1.2-rc1.3-14.15+build.2012-01-01.11h34', + ], '<=0.1.2': [ '0.1.1', '0.1.2-rc1', |