#NEWLINE# def test_3_ensure_va_kwa( self ) : #NEWLINE# #INDENT# a = A ( ) #NEWLINE# try : #NEWLINE# #INDENT# assert ( a . hello ( 1 , 2 , 3 , 4 , 5 , * ( 'extra va1' , 'extra va2' ) ) == 0 ) , 'should throw TypeError' #NEWLINE# #UNINDENT# except TypeError : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# a . hello = introspect . ensure_va_kwa ( a . hello ) #NEWLINE# expected = self . expect_hello_info . copy ( ) #NEWLINE# expected [ 'varargs' ] = True #NEWLINE# expected [ 'varkw' ] = True #NEWLINE# returned = introspect . callable_info ( a . hello ) #NEWLINE# assert ( returned == expected ) , ( '%s\n!=\n%s' % ( returned , expected ) ) #NEWLINE# assert ( a . hello ( 1 , 2 , 3 , 4 , 5 , * ( 'va1' , 'va2' ) , ** { #NEWLINE# #INDENT# 'kw1' : 1 , #NEWLINE# 'kw2' : 2 , #NEWLINE# #UNINDENT# } ) == { #NEWLINE# #INDENT# 'self' : a , #NEWLINE# 'one' : 1 , #NEWLINE# 'two' : 14 , #NEWLINE# 'three' : 3 , #NEWLINE# 'four' : 4 , #NEWLINE# 'five' : 5 , #NEWLINE# 'foo' : 'oof' , #NEWLINE# 'bar' : 'rab' , #NEWLINE# 'baz' : 'f' , #NEWLINE# #UNINDENT# } ) #NEWLINE# assert ( a . hello ( 'ett' , 'tva' ) == { #NEWLINE# #INDENT# 'self' : a , #NEWLINE# 'one' : 'ett' , #NEWLINE# 'two' : 14 , #NEWLINE# 'three' : None , #NEWLINE# 'four' : 123 , #NEWLINE# 'five' : 'internets' , #NEWLINE# 'foo' : 'oof' , #NEWLINE# 'bar' : 'rab' , #NEWLINE# 'baz' : 'f' , #NEWLINE# #UNINDENT# } ) #NEWLINE# a . none = introspect . ensure_va_kwa ( a . none ) #NEWLINE# a . none ( ) #NEWLINE# a . none ( 1 , 2 ) #NEWLINE# a . none ( 1 , 2 , 3 , 4 ) #NEWLINE# a . none ( 1 , 2 , 3 , 4 , foo = 12 )