summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pym/portage/tests/dep/test_use_reduce.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/pym/portage/tests/dep/test_use_reduce.py b/pym/portage/tests/dep/test_use_reduce.py
new file mode 100644
index 000000000..07b9ddbb9
--- /dev/null
+++ b/pym/portage/tests/dep/test_use_reduce.py
@@ -0,0 +1,29 @@
+# Copyright 2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+from portage.tests import TestCase
+from portage.exception import InvalidDependString
+from portage.dep import paren_reduce, use_reduce
+import portage.dep
+portage.dep._dep_check_strict = True
+
+class UseReduce(TestCase):
+
+ def testUseReduce(self):
+
+ tests = (
+ ('|| ( x y )', True ),
+ ('|| x', False ),
+ ('foo? ( x y )', True ),
+ ('foo? ( bar? x y )', False ),
+ ('foo? x', False ),
+ )
+
+ for dep_str, valid in tests:
+ try:
+ use_reduce(paren_reduce(dep_str), matchall=True)
+ except InvalidDependString:
+ self.assertEqual(valid, False)
+ else:
+ self.assertEqual(valid, True)