From b923dfcdf9ea32072d49ff9f1527d8826327aef4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Barrois?= Date: Fri, 12 Feb 2016 01:18:15 +0100 Subject: Cleanup and document fixes from #31. The PR was broken through fixed in ``next_minor()`` / ``next_major()``. --- tests/test_base.py | 23 ++++++++++++++++++++--- tests/test_match.py | 5 +++-- 2 files changed, 23 insertions(+), 5 deletions(-) (limited to 'tests') diff --git a/tests/test_base.py b/tests/test_base.py index 6b64073..1fcce8c 100755 --- a/tests/test_base.py +++ b/tests/test_base.py @@ -419,6 +419,10 @@ class SpecItemTestCase(unittest.TestCase): '>=2.0.0': (base.SpecItem.KIND_GTE, 2, 0, 0, None, None), '!=0.1.1+rc3': (base.SpecItem.KIND_NEQ, 0, 1, 1, (), ('rc3',)), '!=0.3.0': (base.SpecItem.KIND_NEQ, 0, 3, 0, None, None), + '=0.3.0': (base.SpecItem.KIND_EQUAL, 0, 3, 0, None, None), + '0.3.0': (base.SpecItem.KIND_EQUAL, 0, 3, 0, None, None), + '~0.1.2': (base.SpecItem.KIND_TILDE, 0, 1, 2, None, None), + '^0.1.3': (base.SpecItem.KIND_CARET, 0, 1, 3, None, None), } def test_components(self): @@ -433,14 +437,19 @@ class SpecItemTestCase(unittest.TestCase): self.assertEqual(prerelease, spec.spec.prerelease) self.assertEqual(build, spec.spec.build) - self.assertNotEqual(spec, spec_text) - self.assertEqual(spec_text, str(spec)) - matches = { '==0.1.0': ( ['0.1.0', '0.1.0-rc1', '0.1.0+build1', '0.1.0-rc1+build2'], ['0.0.1', '0.2.0', '0.1.1'], ), + '=0.1.0': ( + ['0.1.0', '0.1.0-rc1', '0.1.0+build1', '0.1.0-rc1+build2'], + ['0.0.1', '0.2.0', '0.1.1'], + ), + '0.1.0': ( + ['0.1.0', '0.1.0-rc1', '0.1.0+build1', '0.1.0-rc1+build2'], + ['0.0.1', '0.2.0', '0.1.1'], + ), '==0.1.2-rc3': ( ['0.1.2-rc3+build1', '0.1.2-rc3+build4.5'], ['0.1.2-rc4', '0.1.2', '0.1.3'], @@ -489,6 +498,14 @@ class SpecItemTestCase(unittest.TestCase): ['0.4.0', '1.3.0', '0.3.4-alpha', '0.3.4-alpha+b1'], ['0.3.4', '0.3.4+b1'], ), + '~1.1.2': ( + ['1.1.3', '1.1.2-alpha', '1.1.2-alpha+b1'], + ['1.1.1', '1.2.1', '2.1.0'], + ), + '^1.1.2': ( + ['1.1.3', '1.2.1', '1.1.2-alpha', '1.1.2-alpha+b1'], + ['1.1.1', '2.1.0'], + ), } def test_matches(self): diff --git a/tests/test_match.py b/tests/test_match.py index 9955b9f..f0b0fe8 100755 --- a/tests/test_match.py +++ b/tests/test_match.py @@ -122,8 +122,9 @@ class MatchTestCase(unittest.TestCase): def test_simple(self): for valid in self.valid_specs: - version = semantic_version.Spec(valid) - self.assertEqual(valid, str(version)) + spec = semantic_version.SpecItem(valid) + normalized = str(spec) + self.assertEqual(spec, semantic_version.SpecItem(normalized)) def test_match(self): for spec_txt, versions in self.matches.items(): -- cgit v1.2.1