public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Zac Medico" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/tests/dep/
Date: Wed,  5 Oct 2011 16:11:47 +0000 (UTC)	[thread overview]
Message-ID: <fa2ee875483ff160d8732ecf12c4801f4b148f93.zmedico@gentoo> (raw)

commit:     fa2ee875483ff160d8732ecf12c4801f4b148f93
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed Oct  5 16:11:13 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed Oct  5 16:11:13 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=fa2ee875

test_best_match_to_list: test all permutations

---
 pym/portage/tests/dep/test_best_match_to_list.py |   28 +++++++++++++++-------
 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 9cf5abd..58ab95b 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)



             reply	other threads:[~2011-10-05 16:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-05 16:11 Zac Medico [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-06-23  1:01 [gentoo-commits] proj/portage:master commit in: pym/portage/tests/dep/ Zac Medico
2012-06-12  7:22 Zac Medico
2011-06-09 14:28 Zac Medico
2011-04-11 23:00 Zac Medico
2011-02-04  6:03 zmedico

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fa2ee875483ff160d8732ecf12c4801f4b148f93.zmedico@gentoo \
    --to=zmedico@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox