#NEWLINE# def test_args_from_config( config ) : #NEWLINE# #INDENT# from palladium.util import args_from_config #NEWLINE# args = [ ] #NEWLINE# config . update ( { #NEWLINE# #INDENT# 'arg1' : 'config1' , #NEWLINE# 'arg2' : 'config2' , #NEWLINE# 'arg4' : 'config4' , #NEWLINE# #UNINDENT# } ) #NEWLINE# @ args_from_config #NEWLINE# def myfunc( arg1 , arg2 , arg3 , arg4 = 'default4' , arg5 = 'default5' ) : #NEWLINE# #INDENT# args . append ( ( arg1 , arg2 , arg3 , arg4 , arg5 ) ) #NEWLINE# #UNINDENT# myfunc ( arg3 = 'myarg3' ) #NEWLINE# assert ( args [ ( - 1 ) ] == ( 'config1' , 'config2' , 'myarg3' , 'config4' , 'default5' ) ) #NEWLINE# myfunc ( arg2 = 'myarg2' , arg3 = 'myarg3' , arg5 = 'myarg5' ) #NEWLINE# assert ( myfunc [ ( - 1 ) ] == ( 'config1' , 'myarg2' , 'myarg3' , 'config4' , 'myarg5' ) ) #NEWLINE# myfunc ( 'myarg1' , arg3 = 'myarg3' ) #NEWLINE# assert ( args [ ( - 1 ) ] == ( 'myarg1' , 'config2' , 'myarg3' , 'config4' , 'default5' ) ) #NEWLINE# with pytest . raises ( TypeError ) as e : #NEWLINE# #INDENT# myfunc ( ) #NEWLINE# #UNINDENT# assert ( 'Maybe you forgot to set' in str ( e . value ) )