Commit 0e22bb5d by Sébastien Eustace Committed by GitHub

Fix the behavior of the ~= operator (#1481)

Fixes #1153
parent 01b01aa6
...@@ -79,7 +79,7 @@ def parse_single_constraint(constraint): # type: (str) -> VersionConstraint ...@@ -79,7 +79,7 @@ def parse_single_constraint(constraint): # type: (str) -> VersionConstraint
low = version low = version
high = version.stable.next_major high = version.stable.next_major
else: else:
low = Version(version.major, version.minor, 0) low = Version(version.major, version.minor, version.patch)
high = version.stable.next_minor high = version.stable.next_minor
return VersionRange( return VersionRange(
......
...@@ -67,7 +67,7 @@ def test_parse_constraint_wildcard(input, constraint): ...@@ -67,7 +67,7 @@ def test_parse_constraint_wildcard(input, constraint):
("~0.3", VersionRange(Version(0, 3, 0), Version(0, 4, 0), True)), ("~0.3", VersionRange(Version(0, 3, 0), Version(0, 4, 0), True)),
("~3.5", VersionRange(Version(3, 5, 0), Version(3, 6, 0), True)), ("~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", VersionRange(Version(3, 5, 0), Version(4, 0, 0), True)), # PEP 440
("~=3.5.3", VersionRange(Version(3, 5, 0), Version(3, 6, 0), True)), # PEP 440 ("~=3.5.3", VersionRange(Version(3, 5, 3), Version(3, 6, 0), True)), # PEP 440
], ],
) )
def test_parse_constraint_tilde(input, constraint): def test_parse_constraint_tilde(input, constraint):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment