summaryrefslogtreecommitdiff
path: root/tests/test_base.py
diff options
context:
space:
mode:
authorRaphaël Barrois <raphael.barrois@polytechnique.org>2012-05-18 01:31:36 +0200
committerRaphaël Barrois <raphael.barrois@polytechnique.org>2012-05-18 01:31:36 +0200
commit3e4f3936e187cdc9625bc30d9d2b27ecd91d8e59 (patch)
tree8ebef768460fd6fc8b105d9d3c754a81f5ac301d /tests/test_base.py
parentae57afda5cc99616d8a6f388cffbf0ec23f59c6a (diff)
downloadsemantic-version-3e4f3936e187cdc9625bc30d9d2b27ecd91d8e59.tar.gz
Allow passing in spec lists in separate arguments to SpecList.
Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
Diffstat (limited to 'tests/test_base.py')
-rwxr-xr-xtests/test_base.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/test_base.py b/tests/test_base.py
index 6dbda18..894c4c3 100755
--- a/tests/test_base.py
+++ b/tests/test_base.py
@@ -293,6 +293,22 @@ class SpecListTestCase(unittest.TestCase):
for spec_text in specs:
self.assertTrue(repr(base.Spec(spec_text)) in repr(spec_list))
+ split_examples = {
+ ('>=0.1.1', '<0.1.2', '!=0.1.1+build1'): ['>=0.1.1', '<0.1.2', '!=0.1.1+build1'],
+ ('>~0.1', '!=0.1.3-rc1,<0.1.3'): ['>~0.1', '!=0.1.3-rc1', '<0.1.3'],
+ }
+
+ def test_parsing_split(self):
+ for spec_list_texts, specs in self.split_examples.items():
+ spec_list = base.SpecList(*spec_list_texts)
+
+ self.assertEqual(','.join(spec_list_texts), str(spec_list))
+ self.assertEqual(specs, [str(spec) for spec in spec_list])
+ self.assertEqual(spec_list, base.SpecList(','.join(spec_list_texts)))
+
+ for spec_text in specs:
+ self.assertTrue(repr(base.Spec(spec_text)) in repr(spec_list))
+
matches = {
'>=0.1.1,<0.1.2': (
['0.1.1', '0.1.2-alpha', '0.1.1+4'],