Commit 64d172b8 by Sébastien Eustace

Fix tilde operator parsing in semver package

parent cdda1393
...@@ -111,7 +111,7 @@ class VersionParser: ...@@ -111,7 +111,7 @@ class VersionParser:
elif m.group(3): elif m.group(3):
position = 2 position = 2
elif m.group(2): elif m.group(2):
position = 1 position = 2
else: else:
position = 0 position = 0
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
"dependencies": [ "dependencies": [
{ {
"name": "django", "name": "django",
"version": "1.4.1", "version": "1.4.3",
"dependencies": [ "dependencies": [
] ]
......
...@@ -49,10 +49,10 @@ from poetry.semver import sort, rsort, statisfies, satisfied_by ...@@ -49,10 +49,10 @@ from poetry.semver import sort, rsort, statisfies, satisfied_by
('2.1.3', '1.2.* || 2.*'), ('2.1.3', '1.2.* || 2.*'),
('1.2.3', '1.2.* || 2.*'), ('1.2.3', '1.2.* || 2.*'),
('1.2.3', '*'), ('1.2.3', '*'),
('2.9.0', '~2.4'), # >= 2.4.0 < 3.0.0 ('2.9.0', '^2.4'), # >= 2.4.0 < 3.0.0
('2.4.5', '~2.4'), ('2.4.5', '~2.4'),
('1.2.3', '~1'), # >= 1.0.0 < 2.0.0 ('1.2.3', '~1'), # >= 1.0.0 < 2.0.0
('1.4.7', '~1.0'), # >= 1.0.0 < 2.0.0 ('1.0.7', '~1.0'), # >= 1.0.0 < 1.1.0
('1.0.0', '>=1'), ('1.0.0', '>=1'),
('1.0.0', '>= 1'), ('1.0.0', '>= 1'),
('1.2.8', '>1.2'), # > 1.2.0 ('1.2.8', '>1.2'), # > 1.2.0
...@@ -135,8 +135,8 @@ def test_statisfies_negative(version, constraint): ...@@ -135,8 +135,8 @@ def test_statisfies_negative(version, constraint):
[ [
( (
'~1.0', '~1.0',
['1.0', '1.2', '1.9999.9999', '2.0', '2.1', '0.9999.9999'], ['1.0', '1.0.9', '1.2', '2.0', '2.1', '0.9999.9999'],
['1.0', '1.2', '1.9999.9999'], ['1.0', '1.0.9'],
), ),
( (
'>1.0 <3.0 || >=4.0', '>1.0 <3.0 || >=4.0',
......
...@@ -64,13 +64,14 @@ def test_parse_constraints_wildcard(parser, input, min, max): ...@@ -64,13 +64,14 @@ def test_parse_constraints_wildcard(parser, input, min, max):
'input,min,max', 'input,min,max',
[ [
('~v1', Constraint('>=', '1.0.0.0'), Constraint('<', '2.0.0.0')), ('~v1', Constraint('>=', '1.0.0.0'), Constraint('<', '2.0.0.0')),
('~1.0', Constraint('>=', '1.0.0.0'), Constraint('<', '2.0.0.0')), ('~1.0', Constraint('>=', '1.0.0.0'), Constraint('<', '1.1.0.0')),
('~1.0.0', Constraint('>=', '1.0.0.0'), Constraint('<', '1.1.0.0')), ('~1.0.0', Constraint('>=', '1.0.0.0'), Constraint('<', '1.1.0.0')),
('~1.2', Constraint('>=', '1.2.0.0'), Constraint('<', '2.0.0.0')), ('~1.2', Constraint('>=', '1.2.0.0'), Constraint('<', '1.3.0.0')),
('~1.2.3', Constraint('>=', '1.2.3.0'), Constraint('<', '1.3.0.0')), ('~1.2.3', Constraint('>=', '1.2.3.0'), Constraint('<', '1.3.0.0')),
('~1.2.3.4', Constraint('>=', '1.2.3.4'), Constraint('<', '1.2.4.0')), ('~1.2.3.4', Constraint('>=', '1.2.3.4'), Constraint('<', '1.2.4.0')),
('~1.2-beta', Constraint('>=', '1.2.0.0-beta'), Constraint('<', '2.0.0.0')), ('~1.2-beta', Constraint('>=', '1.2.0.0-beta'), Constraint('<', '1.3.0.0')),
('~1.2-b2', Constraint('>=', '1.2.0.0-beta.2'), Constraint('<', '2.0.0.0')), ('~1.2-b2', Constraint('>=', '1.2.0.0-beta.2'), Constraint('<', '1.3.0.0')),
('~0.3', Constraint('>=', '0.3.0.0'), Constraint('<', '0.4.0.0')),
] ]
) )
def test_parse_constraints_tilde(parser, input, min, max): def test_parse_constraints_tilde(parser, input, min, max):
......
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