mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
Merged revisions 86596 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r86596 | ezio.melotti | 2010-11-20 21:04:17 +0200 (Sat, 20 Nov 2010) | 1 line #9424: Replace deprecated assert* methods in the Python test suite. ........
This commit is contained in:
parent
b65b4937e2
commit
19f2aeba67
164 changed files with 2281 additions and 2279 deletions
|
@ -239,7 +239,7 @@ class Tuple_TestCase(unittest.TestCase):
|
|||
from _testcapi import getargs_tuple
|
||||
|
||||
ret = getargs_tuple(1, (2, 3))
|
||||
self.assertEquals(ret, (1,2,3))
|
||||
self.assertEqual(ret, (1,2,3))
|
||||
|
||||
# make sure invalid tuple arguments are handled correctly
|
||||
class seq:
|
||||
|
@ -252,25 +252,25 @@ class Tuple_TestCase(unittest.TestCase):
|
|||
class Keywords_TestCase(unittest.TestCase):
|
||||
def test_positional_args(self):
|
||||
# using all positional args
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
getargs_keywords((1,2), 3, (4,(5,6)), (7,8,9), 10),
|
||||
(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
|
||||
)
|
||||
def test_mixed_args(self):
|
||||
# positional and keyword args
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
getargs_keywords((1,2), 3, (4,(5,6)), arg4=(7,8,9), arg5=10),
|
||||
(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
|
||||
)
|
||||
def test_keyword_args(self):
|
||||
# all keywords
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
getargs_keywords(arg1=(1,2), arg2=3, arg3=(4,(5,6)), arg4=(7,8,9), arg5=10),
|
||||
(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
|
||||
)
|
||||
def test_optional_args(self):
|
||||
# missing optional keyword args, skipping tuples
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
getargs_keywords(arg1=(1,2), arg2=3, arg5=10),
|
||||
(1, 2, 3, -1, -1, -1, -1, -1, -1, 10)
|
||||
)
|
||||
|
@ -279,14 +279,14 @@ class Keywords_TestCase(unittest.TestCase):
|
|||
try:
|
||||
getargs_keywords(arg1=(1,2))
|
||||
except TypeError as err:
|
||||
self.assertEquals(str(err), "Required argument 'arg2' (pos 2) not found")
|
||||
self.assertEqual(str(err), "Required argument 'arg2' (pos 2) not found")
|
||||
else:
|
||||
self.fail('TypeError should have been raised')
|
||||
def test_too_many_args(self):
|
||||
try:
|
||||
getargs_keywords((1,2),3,(4,(5,6)),(7,8,9),10,111)
|
||||
except TypeError as err:
|
||||
self.assertEquals(str(err), "function takes at most 5 arguments (6 given)")
|
||||
self.assertEqual(str(err), "function takes at most 5 arguments (6 given)")
|
||||
else:
|
||||
self.fail('TypeError should have been raised')
|
||||
def test_invalid_keyword(self):
|
||||
|
@ -294,7 +294,7 @@ class Keywords_TestCase(unittest.TestCase):
|
|||
try:
|
||||
getargs_keywords((1,2),3,arg5=10,arg666=666)
|
||||
except TypeError as err:
|
||||
self.assertEquals(str(err), "'arg666' is an invalid keyword argument for this function")
|
||||
self.assertEqual(str(err), "'arg666' is an invalid keyword argument for this function")
|
||||
else:
|
||||
self.fail('TypeError should have been raised')
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue