def test_generate_accepted_kwargs():
 source_dictionary = {'argument1': 1, 'argument2': 2, 'hey': 'there', 'hi': 'hello'}
 kwargs = hug.introspect.generate_accepted_kwargs(function_with_kwargs, 'bacon', 'argument1')(source_dictionary)
 assert (kwargs == source_dictionary)
 kwargs = hug.introspect.generate_accepted_kwargs(function_with_args, 'bacon', 'argument1')(source_dictionary)
 assert (kwargs == {'argument1': 1})
 kwargs = hug.introspect.generate_accepted_kwargs(function_with_neither, 'argument1', 'argument2')(source_dictionary)
 assert (kwargs == {'argument1': 1, 'argument2': 2})
 kwargs = hug.introspect.generate_accepted_kwargs(function_with_both, 'argument1', 'argument2')(source_dictionary)
 assert (kwargs == source_dictionary)

def test_generate_accepted_kwargs ( ) : source_dictionary = { 'argument1' : 1 , 'argument2' : 2 , 'hey' : 'there' , 'hi' : 'hello' } kwargs = hug . introspect . generate_accepted_kwargs ( function_with_kwargs , 'bacon' , 'argument1' ) ( source_dictionary ) assert ( kwargs == source_dictionary ) kwargs = hug . introspect . generate_accepted_kwargs ( function_with_args , 'bacon' , 'argument1' ) ( source_dictionary ) assert ( kwargs == { 'argument1' : 1 } ) kwargs = hug . introspect . generate_accepted_kwargs ( function_with_neither , 'argument1' , 'argument2' ) ( source_dictionary ) assert ( kwargs == { 'argument1' : 1 , 'argument2' : 2 } ) kwargs = hug . introspect . generate_accepted_kwargs ( function_with_both , 'argument1' , 'argument2' ) ( source_dictionary ) assert ( kwargs == source_dictionary )
test to ensure hug introspection can correctly dynamically filter out kwargs for only those accepted .