diff options
author | Raphaël Barrois <raphael.barrois@polytechnique.org> | 2019-08-23 19:26:24 +0200 |
---|---|---|
committer | Raphaël Barrois <raphael.barrois@polytechnique.org> | 2019-08-24 15:13:09 +0200 |
commit | c24f4e2157438be40b44e6ba02d90c6bfa934454 (patch) | |
tree | 66ecf2747c6a605688c0a934d94bab539085c11e /tests/test_match.py | |
parent | 13902f1812697bac01ea1172663a6eedd20ac9d5 (diff) | |
download | semantic-version-c24f4e2157438be40b44e6ba02d90c6bfa934454.tar.gz |
Fix inconsistent matching behaviour.
According to the stated goal of "intuitive" behaviour, we want:
``Version('0.1.1-a1') not in Spec('<0.1.1')``.
Tests, code and docs have been fixed.
Diffstat (limited to 'tests/test_match.py')
-rwxr-xr-x | tests/test_match.py | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/tests/test_match.py b/tests/test_match.py index 16d7e5a..4bf7162 100755 --- a/tests/test_match.py +++ b/tests/test_match.py @@ -47,22 +47,13 @@ class MatchTestCase(unittest.TestCase): '1.0.0', ], '==0.1.2': [ - '0.1.2-rc1', - '0.1.2-rc1.3.4', '0.1.2+build42-12.2012-01-01.12h23', - '0.1.2-rc1.3-14.15+build.2012-01-01.11h34', ], '=0.1.2': [ - '0.1.2-rc1', - '0.1.2-rc1.3.4', '0.1.2+build42-12.2012-01-01.12h23', - '0.1.2-rc1.3-14.15+build.2012-01-01.11h34', ], '0.1.2': [ - '0.1.2-rc1', - '0.1.2-rc1.3.4', '0.1.2+build42-12.2012-01-01.12h23', - '0.1.2-rc1.3-14.15+build.2012-01-01.11h34', ], '<=0.1.2': [ '0.1.1', @@ -146,9 +137,9 @@ class MatchTestCase(unittest.TestCase): spec = semantic_version.Spec(spec_text) self.assertNotEqual(spec, spec_text) version = semantic_version.Version(version_text) + self.assertIn(version, spec) self.assertTrue(spec.match(version), "%r does not match %r" % (version, spec)) self.assertTrue(semantic_version.match(spec_text, version_text)) - self.assertTrue(version in spec, "%r not in %r" % (version, spec)) def test_contains(self): spec = semantic_version.Spec('<=0.1.1') @@ -164,7 +155,7 @@ class MatchTestCase(unittest.TestCase): strict_spec = semantic_version.Spec('>=0.1.1-') lax_spec = semantic_version.Spec('>=0.1.1') version = semantic_version.Version('0.1.1-rc1+4.2') - self.assertTrue(version in lax_spec, "%r should be in %r" % (version, lax_spec)) + self.assertFalse(version in lax_spec, "%r should not be in %r" % (version, lax_spec)) self.assertFalse(version in strict_spec, "%r should not be in %r" % (version, strict_spec)) def test_build_check(self): |