From: Zac Medico Date: Thu, 5 Mar 2009 05:21:36 +0000 (-0000) Subject: Add tests for use_reduce() and paren_reduce(). X-Git-Tag: v2.2_rc24~56 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=bd4f9b4bb03901e2c8420f6f734ae550673fec5f;p=portage.git Add tests for use_reduce() and paren_reduce(). svn path=/main/trunk/; revision=12759 --- 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)