summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xexts/pip_find_deps_tests.py27
1 files changed, 18 insertions, 9 deletions
diff --git a/exts/pip_find_deps_tests.py b/exts/pip_find_deps_tests.py
index 83fe4b1..b838714 100755
--- a/exts/pip_find_deps_tests.py
+++ b/exts/pip_find_deps_tests.py
@@ -46,19 +46,28 @@ class ConflictDetectionTests(unittest.TestCase):
('==', parse_version('0.2')))])
def test_less_than(self):
- # ('==', '0.1') conflicts with ('<', 0.1)
- requirements = parse_requirements(['a == 0.1', 'a < 0.1'])
- # TODO: and the reverse
+ def run(requirements, expected_conflicts):
+ deps = pip_find_deps.resolve_version_constraints(requirements)
- deps = pip_find_deps.resolve_version_constraints(requirements)
+ self.assertEqual(len(deps), 1)
- self.assertEqual(len(deps), 1)
+ _, dep = deps.popitem()
- _, dep = deps.popitem()
+ self.assertEqual(len(dep.conflicts), 1)
+ self.assertEqual(dep.conflicts, expected_conflicts)
- self.assertEqual(len(dep.conflicts), 1)
- self.assertEqual(dep.conflicts, [(('==', parse_version('0.1')),
- ('<', parse_version('0.1')))])
+ def reverse(xs):
+ return xs[::-1]
+
+ requirements = list(parse_requirements(['a == 0.1', 'a < 0.1']))
+ expected_conflicts = [(('==', parse_version('0.1')),
+ ('<', parse_version('0.1')))]
+
+ # ('==', '0.1') conflicts with ('<', 0.1)
+ run(requirements, expected_conflicts)
+
+ # ('<', 0.1) conflicts with ('==', '0.1')
+ run(reverse(requirements), reverse(expected_conflicts))
if __name__ == '__main__':