Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions poetry/semver/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,12 @@ def parse_single_constraint(constraint): # type: (str) -> VersionConstraint
version = Version.parse(m.group(1))

if precision == 2:
low = version
high = version.stable.next_major
else:
low = Version(version.major, version.minor, version.patch)
high = version.stable.next_minor

return VersionRange(
low, high, include_min=True, always_include_max_prerelease=True
version, high, include_min=True, always_include_max_prerelease=True
)

# Caret range
Expand Down
4 changes: 4 additions & 0 deletions tests/semver/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ def test_parse_constraint_wildcard(input, constraint):
("~3.5", VersionRange(Version(3, 5, 0), Version(3, 6, 0), True)),
("~=3.5", VersionRange(Version(3, 5, 0), Version(4, 0, 0), True)), # PEP 440
("~=3.5.3", VersionRange(Version(3, 5, 3), Version(3, 6, 0), True)), # PEP 440
(
"~=3.5.3rc1",
VersionRange(Version(3, 5, 3, pre="rc1"), Version(3, 6, 0), True),
), # PEP 440
],
)
def test_parse_constraint_tilde(input, constraint):
Expand Down