From bd4f9b4bb03901e2c8420f6f734ae550673fec5f Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 5 Mar 2009 05:21:36 +0000 Subject: [PATCH] Add tests for use_reduce() and paren_reduce(). svn path=/main/trunk/; revision=12759 --- pym/portage/tests/dep/test_use_reduce.py | 29 ++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 pym/portage/tests/dep/test_use_reduce.py 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) -- 2.26.2