Package portage :: Package tests :: Package util :: Module test_stackDicts
[hide private]

Source Code for Module portage.tests.util.test_stackDicts

 1  # test_stackDicts.py -- Portage Unit Testing Functionality 
 2  # Copyright 2006 Gentoo Foundation 
 3  # Distributed under the terms of the GNU General Public License v2 
 4   
 5  from portage.tests import TestCase 
 6  from portage.util import stack_dicts 
 7   
 8   
9 -class StackDictsTestCase(TestCase):
10
11 - def testStackDictsPass(self):
12 13 tests = [ 14 ([{'a': 'b'}, {'b': 'c'}], {'a': 'b', 'b': 'c'}, False, [], False), 15 ([{'a': 'b'}, {'a': 'c'}], {'a': 'b c'}, True, [], False), 16 ([{'a': 'b'}, {'a': 'c'}], {'a': 'b c'}, False, ['a'], False), 17 ([{'a': 'b'}, None], {'a': 'b'}, False, [], True), 18 ([None], {}, False, [], False), 19 ([None, {}], {}, False, [], True) 20 ] 21 for test in tests: 22 result = stack_dicts(test[0], test[2], test[3], test[4]) 23 self.assertEqual(result, test[1])
24
25 - def testStackDictsFail(self):
26 27 tests = [ 28 ([None, {}], None, False, [], True), 29 ([{'a': 'b'}, {'a': 'c'}], {'a': 'b c'}, False, [], False) 30 ] 31 for test in tests: 32 result = stack_dicts(test[0], test[2], test[3], test[4]) 33 self.assertNotEqual(result, test[1])
34