Fix a bug with compatible release clauses and patch versions

Previously, if the patch version was 0 (i.e. as in ~=2.2.0),
this would cause the range to be interpreted as ~=2.2.
This commit is contained in:
Martin Ek 2016-03-07 13:22:13 +01:00
parent b08014a65e
commit 2d3f694f85
2 changed files with 5 additions and 1 deletions

View File

@ -470,7 +470,7 @@ class SpecItem(object):
elif self.kind == self.KIND_TILDE:
return self.spec <= version < self.spec.next_minor()
elif self.kind == self.KIND_COMPATIBLE:
if self.spec.patch:
if self.spec.patch is not None:
upper = self.spec.next_minor()
else:
upper = self.spec.next_major()

View File

@ -518,6 +518,10 @@ class SpecItemTestCase(unittest.TestCase):
['1.4.5', '1.4.10-alpha', '1.4.10'],
['1.3.6', '1.4.4', '1.5.0'],
),
'~=1.4.0': (
['1.4.0', '1.4.10-alpha', '1.4.10'],
['1.3.6', '1.3.9', '1.5.0'],
),
'~=1.4': (
['1.4.0', '1.6.10-alpha', '1.6.10'],
['1.3.0', '2.0.0'],