diff options
author | Raphaël Barrois <raphael.barrois@polytechnique.org> | 2019-08-24 14:04:55 +0200 |
---|---|---|
committer | Raphaël Barrois <raphael.barrois@polytechnique.org> | 2019-08-26 21:34:44 +0200 |
commit | c415ee4cd87915191b1ca8df2d3fbf7e49d4bbbf (patch) | |
tree | 4192534d6ed4c301cd640417f50223925bd0240e /tests/test_parsing.py | |
parent | 47fc7229ba24de0610134cadcc61884c6097f4fe (diff) | |
download | semantic-version-c415ee4cd87915191b1ca8df2d3fbf7e49d4bbbf.tar.gz |
Add `Version.precedence_key`.
This will be used in `sort(..., key=lambda v: v.precedence_key)`.
Remove previous comparison/ordering implementation.
The current implementation relies on a 4-tuple:
- major, minor, patch (as integers) - natural order matches precedence
rules
- a tuple of identifiers for the prerelease component.
The identifiers for the prerelease components are based on:
- A `NumericIdentifier` class, that compares number using their natural
order, and always compares lower than non-numeric identifiers
- A `AlphaIdentifier` class for non-numeric identifiers; it compares
versions using ASCII ordering.
- A `MaxIdentifier` class, that compares higher to any other identifier;
used to ensure that a non-prerelease version is greater than any of
its prereleases.
Diffstat (limited to 'tests/test_parsing.py')
-rwxr-xr-x | tests/test_parsing.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/test_parsing.py b/tests/test_parsing.py index 2d612a1..0da679f 100755 --- a/tests/test_parsing.py +++ b/tests/test_parsing.py @@ -120,9 +120,9 @@ class ComparisonTestCase(unittest.TestCase): self.assertFalse(v1 == v2, "%r == %r" % (v1, v2)) self.assertTrue(v1 != v2, "%r !!= %r" % (v1, v2)) self.assertFalse(v1 < v2, "%r !< %r" % (v1, v2)) - self.assertFalse(v1 <= v2, "%r !<= %r" % (v1, v2)) + self.assertTrue(v1 <= v2, "%r !<= %r" % (v1, v2)) self.assertFalse(v2 > v1, "%r !> %r" % (v2, v1)) - self.assertFalse(v2 >= v1, "%r !>= %r" % (v2, v1)) + self.assertTrue(v2 >= v1, "%r !>= %r" % (v2, v1)) if __name__ == '__main__': # pragma: no cover |