summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-10-05 09:11:13 -0700
committerZac Medico <zmedico@gentoo.org>2011-10-05 09:11:13 -0700
commitfa2ee875483ff160d8732ecf12c4801f4b148f93 (patch)
tree356c5aac9439193bad21a6d8d7723eda967d893c /pym
parent1c8ff00a26b0e2e3627e9c552374f71235ee6c39 (diff)
downloadportage-fa2ee875483ff160d8732ecf12c4801f4b148f93.tar.gz
portage-fa2ee875483ff160d8732ecf12c4801f4b148f93.tar.bz2
portage-fa2ee875483ff160d8732ecf12c4801f4b148f93.zip
test_best_match_to_list: test all permutationsv2.2.0_alpha61
Diffstat (limited to 'pym')
-rw-r--r--pym/portage/tests/dep/test_best_match_to_list.py28
1 files changed, 19 insertions, 9 deletions
diff --git a/pym/portage/tests/dep/test_best_match_to_list.py b/pym/portage/tests/dep/test_best_match_to_list.py
index 9cf5abdd5..58ab95b0f 100644
--- a/pym/portage/tests/dep/test_best_match_to_list.py
+++ b/pym/portage/tests/dep/test_best_match_to_list.py
@@ -1,7 +1,9 @@
# test_best_match_to_list.py -- Portage Unit Testing Functionality
-# Copyright 2010 Gentoo Foundation
+# Copyright 2010-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
+from itertools import permutations
+
from portage.tests import TestCase
from portage.dep import Atom, best_match_to_list
@@ -13,6 +15,7 @@ class Test_best_match_to_list(TestCase):
list of matching atoms.
"""
ret = []
+ mylist = list(mylist)
while mylist:
m = best_match_to_list(mypkg, mylist)
if m is not None:
@@ -26,22 +29,29 @@ class Test_best_match_to_list(TestCase):
def testBest_match_to_list(self):
tests = [
("dev-libs/A-4", [Atom(">=dev-libs/A-3"), Atom(">=dev-libs/A-2")], \
- [Atom(">=dev-libs/A-3"), Atom(">=dev-libs/A-2")]),
+ [Atom(">=dev-libs/A-3"), Atom(">=dev-libs/A-2")], True),
("dev-libs/A-4", [Atom("<=dev-libs/A-5"), Atom("<=dev-libs/A-6")], \
- [Atom("<=dev-libs/A-5"), Atom("<=dev-libs/A-6")]),
+ [Atom("<=dev-libs/A-5"), Atom("<=dev-libs/A-6")], True),
("dev-libs/A-1", [Atom("dev-libs/A"), Atom("=dev-libs/A-1")], \
- [Atom("=dev-libs/A-1"), Atom("dev-libs/A")]),
+ [Atom("=dev-libs/A-1"), Atom("dev-libs/A")], True),
("dev-libs/A-1", [Atom("dev-libs/B"), Atom("=dev-libs/A-1:0")], \
- [Atom("=dev-libs/A-1:0")]),
+ [Atom("=dev-libs/A-1:0")], True),
("dev-libs/A-1", [Atom("dev-libs/*", allow_wildcard=True), Atom("=dev-libs/A-1:0")], \
- [Atom("=dev-libs/A-1:0"), Atom("dev-libs/*", allow_wildcard=True)]),
+ [Atom("=dev-libs/A-1:0"), Atom("dev-libs/*", allow_wildcard=True)], True),
("dev-libs/A-1:0", [Atom("dev-*/*", allow_wildcard=True), Atom("dev-*/*:0", allow_wildcard=True),\
Atom("dev-libs/A"), Atom("<=dev-libs/A-2"), Atom("dev-libs/A:0"), \
Atom("=dev-libs/A-1*"), Atom("~dev-libs/A-1"), Atom("=dev-libs/A-1")], \
[Atom("=dev-libs/A-1"), Atom("~dev-libs/A-1"), Atom("=dev-libs/A-1*"), \
Atom("dev-libs/A:0"), Atom("<=dev-libs/A-2"), Atom("dev-libs/A"), \
- Atom("dev-*/*:0", allow_wildcard=True), Atom("dev-*/*", allow_wildcard=True)])
+ Atom("dev-*/*:0", allow_wildcard=True), Atom("dev-*/*", allow_wildcard=True)], False)
]
- for pkg, atom_list, result in tests:
- self.assertEqual( self.best_match_to_list_wrapper( pkg, atom_list ), result )
+ for pkg, atom_list, result, all_permutations in tests:
+ if all_permutations:
+ atom_lists = permutations(atom_list)
+ else:
+ atom_lists = [atom_list]
+ for atom_list in atom_lists:
+ self.assertEqual(
+ self.best_match_to_list_wrapper(pkg, atom_list),
+ result)