From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1RBU4b-0005Y4-9r for garchives@archives.gentoo.org; Wed, 05 Oct 2011 16:11:57 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 09BD421C0C0; Wed, 5 Oct 2011 16:11:48 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id B678721C0C0 for ; Wed, 5 Oct 2011 16:11:48 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 1C4D81B4037 for ; Wed, 5 Oct 2011 16:11:48 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 4D3C180042 for ; Wed, 5 Oct 2011 16:11:47 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/tests/dep/ X-VCS-Repository: proj/portage X-VCS-Files: pym/portage/tests/dep/test_best_match_to_list.py X-VCS-Directories: pym/portage/tests/dep/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: fa2ee875483ff160d8732ecf12c4801f4b148f93 Date: Wed, 5 Oct 2011 16:11:47 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 4481ae7b2fa864ee344b829e6e882d5b commit: fa2ee875483ff160d8732ecf12c4801f4b148f93 Author: Zac Medico gentoo org> AuthorDate: Wed Oct 5 16:11:13 2011 +0000 Commit: Zac Medico gentoo org> CommitDate: Wed Oct 5 16:11:13 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3Dfa2ee875 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/porta= ge/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 =20 +from itertools import permutations + from portage.tests import TestCase from portage.dep import Atom, best_match_to_list =20 @@ -13,6 +15,7 @@ class Test_best_match_to_list(TestCase): list of matching atoms. """ ret =3D [] + mylist =3D list(mylist) while mylist: m =3D 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 =3D [ ("dev-libs/A-4", [Atom(">=3Ddev-libs/A-3"), Atom(">=3Ddev-libs/A-2"= )], \ - [Atom(">=3Ddev-libs/A-3"), Atom(">=3Ddev-libs/A-2")]), + [Atom(">=3Ddev-libs/A-3"), Atom(">=3Ddev-libs/A-2")], True), ("dev-libs/A-4", [Atom("<=3Ddev-libs/A-5"), Atom("<=3Ddev-libs/A-6"= )], \ - [Atom("<=3Ddev-libs/A-5"), Atom("<=3Ddev-libs/A-6")]), + [Atom("<=3Ddev-libs/A-5"), Atom("<=3Ddev-libs/A-6")], True), ("dev-libs/A-1", [Atom("dev-libs/A"), Atom("=3Ddev-libs/A-1")], \ - [Atom("=3Ddev-libs/A-1"), Atom("dev-libs/A")]), + [Atom("=3Ddev-libs/A-1"), Atom("dev-libs/A")], True), ("dev-libs/A-1", [Atom("dev-libs/B"), Atom("=3Ddev-libs/A-1:0")], \ - [Atom("=3Ddev-libs/A-1:0")]), + [Atom("=3Ddev-libs/A-1:0")], True), ("dev-libs/A-1", [Atom("dev-libs/*", allow_wildcard=3DTrue), Atom("= =3Ddev-libs/A-1:0")], \ - [Atom("=3Ddev-libs/A-1:0"), Atom("dev-libs/*", allow_wildcard=3DTr= ue)]), + [Atom("=3Ddev-libs/A-1:0"), Atom("dev-libs/*", allow_wildcard=3DTr= ue)], True), ("dev-libs/A-1:0", [Atom("dev-*/*", allow_wildcard=3DTrue), Atom("d= ev-*/*:0", allow_wildcard=3DTrue),\ Atom("dev-libs/A"), Atom("<=3Ddev-libs/A-2"), Atom("dev-libs/A:0")= , \ Atom("=3Ddev-libs/A-1*"), Atom("~dev-libs/A-1"), Atom("=3Ddev-libs= /A-1")], \ [Atom("=3Ddev-libs/A-1"), Atom("~dev-libs/A-1"), Atom("=3Ddev-libs= /A-1*"), \ Atom("dev-libs/A:0"), Atom("<=3Ddev-libs/A-2"), Atom("dev-libs/A")= , \ - Atom("dev-*/*:0", allow_wildcard=3DTrue), Atom("dev-*/*", allow_wi= ldcard=3DTrue)]) + Atom("dev-*/*:0", allow_wildcard=3DTrue), Atom("dev-*/*", allow_wi= ldcard=3DTrue)], False) ] =20 - 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 =3D permutations(atom_list) + else: + atom_lists =3D [atom_list] + for atom_list in atom_lists: + self.assertEqual( + self.best_match_to_list_wrapper(pkg, atom_list), + result)