diff options
author | Richard Ipsum <richard.ipsum@codethink.co.uk> | 2014-11-06 19:13:56 +0000 |
---|---|---|
committer | Richard Ipsum <richard.ipsum@codethink.co.uk> | 2014-11-06 19:13:56 +0000 |
commit | c54b7eaca3f9d68ade36cf82201083947086c966 (patch) | |
tree | 7513127f11d9f22d749d9791584a538b61eac390 | |
parent | c7130fc2484f08ba6d8b2e34d451609c75f4aa1e (diff) | |
download | import-c54b7eaca3f9d68ade36cf82201083947086c966.tar.gz |
Make test_less_than test reverse
-rwxr-xr-x | exts/pip_find_deps_tests.py | 27 |
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__': |