diff options
author | Alec Warner <antarus@gentoo.org> | 2007-01-11 19:43:03 +0000 |
---|---|---|
committer | Alec Warner <antarus@gentoo.org> | 2007-01-11 19:43:03 +0000 |
commit | 230271398ae96229f7d5aff160d5d5ea6b5db3e1 (patch) | |
tree | 409dba9c896988124ae2acb978fe3bdcaa652035 | |
parent | 9b788ebbb283ea1c98644ed57ac67e654cfc767a (diff) | |
download | portage-230271398ae96229f7d5aff160d5d5ea6b5db3e1.tar.gz portage-230271398ae96229f7d5aff160d5d5ea6b5db3e1.tar.bz2 portage-230271398ae96229f7d5aff160d5d5ea6b5db3e1.zip |
take some advice and use AssertEqual/NotEqual
svn path=/main/trunk/; revision=5560
-rw-r--r-- | tests/portage_dep/test_get_operator.py | 8 | ||||
-rw-r--r-- | tests/portage_dep/test_isvalidatom.py | 3 | ||||
-rw-r--r-- | tests/portage_dep/test_match_from_list.py | 6 | ||||
-rw-r--r-- | tests/portage_util/test_normalizedPath.py | 3 | ||||
-rw-r--r-- | tests/portage_util/test_stackDictList.py | 5 | ||||
-rw-r--r-- | tests/portage_util/test_stackDicts.py | 6 | ||||
-rw-r--r-- | tests/portage_util/test_stackLists.py | 4 |
7 files changed, 11 insertions, 24 deletions
diff --git a/tests/portage_dep/test_get_operator.py b/tests/portage_dep/test_get_operator.py index b2fa5965b..ec052d914 100644 --- a/tests/portage_dep/test_get_operator.py +++ b/tests/portage_dep/test_get_operator.py @@ -20,11 +20,7 @@ class GetOperator(TestCase): for test in tests: result = get_operator( test[0] + testCP ) - self.failIf( result != test[1], - msg="Expected %s from get_operator( %s ), got \ - %s" % ( test[1], test[0] + testCP, result ) ) + self.assertEqual( result, test[1] ) result = get_operator( "=sys-apps/portage*" ) - self.failIf( result != "=*", - msg="Expected %s from get_operator( %s ), got \ - %s" % ( "=*", "=sys-apps/portage*", result ) ) + self.assertEqual( result , "=*" ) diff --git a/tests/portage_dep/test_isvalidatom.py b/tests/portage_dep/test_isvalidatom.py index bdf4359f8..84225fa78 100644 --- a/tests/portage_dep/test_isvalidatom.py +++ b/tests/portage_dep/test_isvalidatom.py @@ -33,5 +33,4 @@ class IsValidAtom(TestCase): else: atom_type = "invalid" - self.failIf( isvalidatom( test[0] ) != test[1], - msg="%s should be a(n) %s atom!" % (test[0], atom_type ) ) + self.assertEqual( bool(isvalidatom( test[0] )), test[1] ) diff --git a/tests/portage_dep/test_match_from_list.py b/tests/portage_dep/test_match_from_list.py index 7afe51c5e..4526d4e31 100644 --- a/tests/portage_dep/test_match_from_list.py +++ b/tests/portage_dep/test_match_from_list.py @@ -19,15 +19,13 @@ class AtomCmpEqualGlob(TestCase): # ("=sys-fs/udev_cvs*","sys-fs/udev_cvs_pre4" ) ] for test in tests: - self.failIf( len(match_from_list( test[0], [test[1]] )) != 1, - msg="%s should match %s!" % (test[0], test[1]) ) + self.assertEqual( len(match_from_list( test[0], [test[1]] )), 1 ) def testEqualGlobFail(self): tests = [ ("=sys-apps/portage-2*", "sys-apps/portage-2.1" ), ("=sys-apps/portage-2.1*", "sys-apps/portage-2.1.2" ) ] for test in tests: try: - self.failIf( len( match_from_list( test[0], [test[1]] ) ) != 1, - msg="%s shouldn't match %s!" % (test[0], test[1]) ) + self.assertEqual( len( match_from_list( test[0], [test[1]] ) ), 1 ) except TypeError: # failure is ok here pass diff --git a/tests/portage_util/test_normalizedPath.py b/tests/portage_util/test_normalizedPath.py index 9f9a60597..3354e254e 100644 --- a/tests/portage_util/test_normalizedPath.py +++ b/tests/portage_util/test_normalizedPath.py @@ -12,5 +12,4 @@ class NormalizePathTestCase(TestCase): from portage_util import normalize_path path = "///foo/bar/baz" good = "/foo/bar/baz" - self.failUnless(normalize_path(path) == good, msg="NormalizePath(%s) failed to produce %s" % (path, good)) - + self.assertEqual(normalize_path(path), good) diff --git a/tests/portage_util/test_stackDictList.py b/tests/portage_util/test_stackDictList.py index e6442ce43..02284e8f4 100644 --- a/tests/portage_util/test_stackDictList.py +++ b/tests/portage_util/test_stackDictList.py @@ -14,6 +14,5 @@ class StackDictListTestCase(TestCase): tests.append(( {'KEYWORDS':['alpha','x86']},{'KEYWORDS':['-*']},True,{} )) tests.append(( {'KEYWORDS':['alpha','x86']},{'KEYWORDS':['-x86']},True,{'KEYWORDS':['alpha']} )) for test in tests: - self.failUnless(stack_dictlist([test[0],test[1]],incremental=test[2]) == test[3], - msg="%s and %s combined, was expecting: %s and got: %s" % (test[0],test[1],test[3], - stack_dictlist([test[0],test[1]],incremental=test[2])) ) + self.assertEqual( + stack_dictlist([test[0],test[1]],incremental=test[2]), test[3] ) diff --git a/tests/portage_util/test_stackDicts.py b/tests/portage_util/test_stackDicts.py index ac0e67ef8..98467b5a5 100644 --- a/tests/portage_util/test_stackDicts.py +++ b/tests/portage_util/test_stackDicts.py @@ -25,8 +25,7 @@ class StackDictsTestCase(TestCase): 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] ) ) + self.assertEqual( result, test[1] ) def testStackDictsFail(self): @@ -35,5 +34,4 @@ class StackDictsTestCase(TestCase): 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]) ) + self.assertNotEqual( result , test[1] ) diff --git a/tests/portage_util/test_stackLists.py b/tests/portage_util/test_stackLists.py index c69139286..c4e1e0056 100644 --- a/tests/portage_util/test_stackLists.py +++ b/tests/portage_util/test_stackLists.py @@ -17,6 +17,4 @@ class StackListsTestCase(TestCase): for test in tests: result = stack_lists( test[0], test[2] ) - self.failIf( result != test[1], - msg="Got %s != %s from stack_lists( %s, %s )" \ - % ( result, test[1], test[0], test[2] ) ) + self.assertEqual( result , test[1] ) |