summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pym/portage/tests/dep/test_match_from_list.py38
1 files changed, 17 insertions, 21 deletions
diff --git a/pym/portage/tests/dep/test_match_from_list.py b/pym/portage/tests/dep/test_match_from_list.py
index d6df1f29f..e5a418cd8 100644
--- a/pym/portage/tests/dep/test_match_from_list.py
+++ b/pym/portage/tests/dep/test_match_from_list.py
@@ -5,26 +5,22 @@
from portage.tests import TestCase
from portage.dep import match_from_list
-class AtomCmpEqualGlob(TestCase):
- """ A simple testcase for =* glob matching
- """
+class Test_match_from_list(TestCase):
- def testEqualGlobPass(self):
- tests = [ ("=sys-apps/portage-45*", "sys-apps/portage-045" ),
- ("=sys-fs/udev-1*", "sys-fs/udev-123"),
- ("=sys-fs/udev-4*", "sys-fs/udev-456" ) ]
+ def testMatch_from_list(self):
+ tests = [ ("=sys-apps/portage-45*", ["sys-apps/portage-045"], ["sys-apps/portage-045"] ),
+ ("=sys-fs/udev-1*", ["sys-fs/udev-123"], ["sys-fs/udev-123"]),
+ ("=sys-fs/udev-4*", ["sys-fs/udev-456"], ["sys-fs/udev-456"] ),
+ ("*/*", ["sys-fs/udev-456"], ["sys-fs/udev-456"] ),
+ ("sys-fs/*", ["sys-fs/udev-456"], ["sys-fs/udev-456"] ),
+ ("*/udev", ["sys-fs/udev-456"], ["sys-fs/udev-456"] ),
+ ("=sys-apps/portage-2*", ["sys-apps/portage-2.1"], ["sys-apps/portage-2.1"] ),
+ ("=sys-apps/portage-2.1*", ["sys-apps/portage-2.1.2"], ["sys-apps/portage-2.1.2"] ),
+ ("dev-libs/*", ["sys-apps/portage-2.1.2"], [] ),
+ ("*/tar", ["sys-apps/portage-2.1.2"], [] ),
+ ("*/*", ["dev-libs/A-1", "dev-libs/B-1"], ["dev-libs/A-1", "dev-libs/B-1"] ),
+ ("dev-libs/*", ["dev-libs/A-1", "sci-libs/B-1"], ["dev-libs/A-1"] )
+ ]
-# I need to look up the cvs syntax
-# ("=sys-fs/udev_cvs*","sys-fs/udev_cvs_pre4" ) ]
-
- for test in tests:
- self.assertEqual( len(match_from_list( test[0], [test[1]] )), 1 )
-
- def testEqualGlobFail(self):
- tests = [ ("=sys-apps/portage-2*", "sys-apps/portage-2.1" ),
- ("=sys-apps/portage-2.1*", "sys-apps/portage-2.1.2" ) ]
- for test in tests:
- try:
- self.assertEqual( len( match_from_list( test[0], [test[1]] ) ), 1 )
- except TypeError: # failure is ok here
- pass
+ for atom, cpv_list, result in tests:
+ self.assertEqual( match_from_list( atom, cpv_list ), result )