Back to index

python3.2  3.2.2
Public Member Functions
test.test_getargs2.Keywords_TestCase Class Reference

List of all members.

Public Member Functions

def test_positional_args
def test_mixed_args
def test_keyword_args
def test_optional_args
def test_required_args
def test_too_many_args
def test_invalid_keyword
def test_surrogate_keyword

Detailed Description

Definition at line 233 of file test_getargs2.py.


Member Function Documentation

Definition at line 279 of file test_getargs2.py.

00279 
00280     def test_invalid_keyword(self):
00281         # extraneous keyword arg
00282         try:
00283             getargs_keywords((1,2),3,arg5=10,arg666=666)
00284         except TypeError as err:
00285             self.assertEqual(str(err), "'arg666' is an invalid keyword argument for this function")
00286         else:
00287             self.fail('TypeError should have been raised')

Here is the call graph for this function:

Definition at line 248 of file test_getargs2.py.

00248 
00249     def test_keyword_args(self):
00250         # all keywords
00251         self.assertEqual(
00252             getargs_keywords(arg1=(1,2), arg2=3, arg3=(4,(5,6)), arg4=(7,8,9), arg5=10),
00253             (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
00254             )

Here is the call graph for this function:

Definition at line 241 of file test_getargs2.py.

00241 
00242     def test_mixed_args(self):
00243         # positional and keyword args
00244         self.assertEqual(
00245             getargs_keywords((1,2), 3, (4,(5,6)), arg4=(7,8,9), arg5=10),
00246             (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
00247             )

Here is the call graph for this function:

Definition at line 255 of file test_getargs2.py.

00255 
00256     def test_optional_args(self):
00257         # missing optional keyword args, skipping tuples
00258         self.assertEqual(
00259             getargs_keywords(arg1=(1,2), arg2=3, arg5=10),
00260             (1, 2, 3, -1, -1, -1, -1, -1, -1, 10)
00261             )

Here is the call graph for this function:

Definition at line 234 of file test_getargs2.py.

00234 
00235     def test_positional_args(self):
00236         # using all positional args
00237         self.assertEqual(
00238             getargs_keywords((1,2), 3, (4,(5,6)), (7,8,9), 10),
00239             (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
00240             )

Here is the call graph for this function:

Definition at line 262 of file test_getargs2.py.

00262 
00263     def test_required_args(self):
00264         # required arg missing
00265         try:
00266             getargs_keywords(arg1=(1,2))
00267         except TypeError as err:
00268             self.assertEqual(str(err), "Required argument 'arg2' (pos 2) not found")
00269         else:
00270             self.fail('TypeError should have been raised')

Here is the call graph for this function:

Definition at line 288 of file test_getargs2.py.

00288 
00289     def test_surrogate_keyword(self):
00290         try:
00291             getargs_keywords((1,2), 3, (4,(5,6)), (7,8,9), **{'\uDC80': 10})
00292         except TypeError as err:
00293             self.assertEqual(str(err), "'\udc80' is an invalid keyword argument for this function")
00294         else:
00295             self.fail('TypeError should have been raised')

Here is the call graph for this function:

Definition at line 271 of file test_getargs2.py.

00271 
00272     def test_too_many_args(self):
00273         try:
00274             getargs_keywords((1,2),3,(4,(5,6)),(7,8,9),10,111)
00275         except TypeError as err:
00276             self.assertEqual(str(err), "function takes at most 5 arguments (6 given)")
00277         else:
00278             self.fail('TypeError should have been raised')

Here is the call graph for this function:


The documentation for this class was generated from the following file: