diff options
author | Alec Warner <antarus@gentoo.org> | 2007-01-11 08:45:13 +0000 |
---|---|---|
committer | Alec Warner <antarus@gentoo.org> | 2007-01-11 08:45:13 +0000 |
commit | 848f6e5d29a84970c2356fb9af45326288f73ed6 (patch) | |
tree | 5c1e45a16c3df87e82dc52a4f35f2c2e2cf6151a /tests/portage_util/test_stackDicts.py | |
parent | b1bee095d4276b071ebb34a0c2ed9ee1db4570d9 (diff) | |
download | portage-848f6e5d29a84970c2356fb9af45326288f73ed6.tar.gz portage-848f6e5d29a84970c2356fb9af45326288f73ed6.tar.bz2 portage-848f6e5d29a84970c2356fb9af45326288f73ed6.zip |
More portage_util tests
svn path=/main/trunk/; revision=5547
Diffstat (limited to 'tests/portage_util/test_stackDicts.py')
-rw-r--r-- | tests/portage_util/test_stackDicts.py | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/tests/portage_util/test_stackDicts.py b/tests/portage_util/test_stackDicts.py index dd0743509..ac0e67ef8 100644 --- a/tests/portage_util/test_stackDicts.py +++ b/tests/portage_util/test_stackDicts.py @@ -4,8 +4,36 @@ # $Id: test_vercmp.py 5213 2006-12-08 00:12:41Z antarus $ from unittest import TestCase +from portage_util import stack_dicts + class StackDictsTestCase(TestCase): - def testStackDicts(self): - pass + def testStackDictsPass(self): + + tests = [ ( [ { "a":"b" }, { "b":"c" } ], { "a":"b", "b":"c" }, + False, [], False ), + ( [ { "a":"b" }, { "a":"c" } ], { "a":"b c" }, + True, [], False ), + ( [ { "a":"b" }, { "a":"c" } ], { "a":"b c" }, + False, ["a"], False ), + ( [ { "a":"b" }, None ], { "a":"b" }, + False, [], True ), + ( [ None ], None, False, [], False ), + ( [ None, {}], {}, False, [], True ) ] + + + for test in tests: + result = stack_dicts( test[0], test[2], test[3], test[4] ) + self.failIf( result != test[1], msg="Expected %s = %s" \ + % ( result, test[1] ) ) + + def testStackDictsFail(self): + + tests = [ ( [ None, {} ], None, False, [], True ), + ( [ { "a":"b"}, {"a":"c" } ], { "a":"b c" }, + False, [], False ) ] + for test in tests: + result = stack_dicts( test[0], test[2], test[3], test[4] ) + self.failIf( result == test[1], msg="Expected %s != %s, got \ + %s == %s!" % (result, test[1], result, test[1]) ) |