1
2
3
4
5 from portage.tests import TestCase
6 from portage.util import stack_dicts
7
8
10
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
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