Skip to content

Commit

Permalink
Merge pull request #201 from python-poetry/fix-caret-zero-parsing
Browse files Browse the repository at this point in the history
Fix parsing of caret constraint with leading zero
  • Loading branch information
sdispater authored Sep 15, 2021
2 parents 14b41a9 + 864f7c6 commit 37deae6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion poetry/core/semver/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def stable(self) -> "Version":

def next_breaking(self) -> "Version":
if self.major == 0:
if self.minor != 0:
if self.minor is not None and self.minor != 0:
return self.next_minor()

if self.precision == 1:
Expand Down
2 changes: 1 addition & 1 deletion tests/semver/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def test_parse_constraint_tilde(input, constraint):
Version.from_parts(1, 0, 0), Version.from_parts(2, 0, 0), True
),
),
("^0", VersionRange(Version.from_parts(0), Version.from_parts(0, 1), True)),
("^0", VersionRange(Version.from_parts(0), Version.from_parts(1), True)),
(
"^0.0",
VersionRange(
Expand Down
16 changes: 16 additions & 0 deletions tests/semver/test_parse_constraint.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,22 @@
include_min=True,
),
),
(
"^0",
VersionRange(
min=Version.from_parts(0),
max=Version.from_parts(1),
include_min=True,
),
),
(
"^0.0",
VersionRange(
min=Version.from_parts(0, 0),
max=Version.from_parts(0, 1),
include_min=True,
),
),
],
)
def test_parse_constraint(constraint, version):
Expand Down

0 comments on commit 37deae6

Please sign in to comment.