summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRaphaël Barrois <raphael.barrois@polytechnique.org>2016-02-12 01:18:15 +0100
committerRaphaël Barrois <raphael.barrois@polytechnique.org>2016-02-12 01:19:45 +0100
commitb923dfcdf9ea32072d49ff9f1527d8826327aef4 (patch)
tree5c6e44d98f9fa0befeac6f8a8d3ed634b0e7fcfd /tests
parent9f4ccad84b77b761f7e2032a8617a5b8d54d9008 (diff)
downloadsemantic-version-b923dfcdf9ea32072d49ff9f1527d8826327aef4.tar.gz
Cleanup and document fixes from #31.
The PR was broken through fixed in ``next_minor()`` / ``next_major()``.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/test_base.py23
-rwxr-xr-xtests/test_match.py5
2 files changed, 23 insertions, 5 deletions
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():