cubicweb/test/unittest_migration.py
changeset 12629 6b314fc558ed
parent 11768 b8b71dd09a2c
child 12745 cc681b6fcffa
--- a/cubicweb/test/unittest_migration.py	Fri May 24 17:09:10 2019 +0200
+++ b/cubicweb/test/unittest_migration.py	Tue May 28 12:35:34 2019 +0200
@@ -22,7 +22,11 @@
 
 from cubicweb import devtools
 from cubicweb.cwconfig import CubicWebConfiguration
-from cubicweb.migration import filter_scripts, version_strictly_lower
+from cubicweb.migration import (
+    filter_scripts,
+    split_constraint,
+    version_strictly_lower,
+)
 
 
 class Schema(dict):
@@ -113,5 +117,16 @@
                              [['activated']])
         repo.shutdown()
 
+def test_split_constraint():
+    assert split_constraint(">=0.1.0") == (">=", "0.1.0")
+    assert split_constraint(">= 0.1.0") == (">=", "0.1.0")
+    assert split_constraint(">0.1.1") == (">", "0.1.1")
+    assert split_constraint("> 0.1.1") == (">", "0.1.1")
+    assert split_constraint("<0.2.0") == ("<", "0.2.0")
+    assert split_constraint("< 0.2.0") == ("<", "0.2.0")
+    assert split_constraint("<=42.1.0") == ("<=", "42.1.0")
+    assert split_constraint("<= 42.1.0") == ("<=", "42.1.0")
+
+
 if __name__ == '__main__':
     unittest_main()