#NEWLINE# def test_arg_kwargs( self ) : #NEWLINE# #INDENT# def process_title( title , title1 = 'test' ) : #NEWLINE# #INDENT# return ( title [ 0 ] + ( title1 [ 0 ] if isinstance ( title1 , list ) else title1 ) ) #NEWLINE# #UNINDENT# def process_title2( title1 = 'test' ) : #NEWLINE# #INDENT# return ( title1 [ 0 ] if isinstance ( title1 , list ) else title1 ) #NEWLINE# #UNINDENT# args = ( '//dc:title/node()' , ) #NEWLINE# kwargs = { #NEWLINE# #INDENT# 'title1' : '//dc:title/node()' , #NEWLINE# #UNINDENT# } #NEWLINE# self . harvester . schema = updated_schema ( TEST_SCHEMA , { #NEWLINE# #INDENT# 'title' : ( pack ( * args , ** kwargs ) , process_title ) , #NEWLINE# 'otherProperties' : build_properties ( ( 'title2' , ( pack ( * args ) , process_title ) ) , ( 'title3' , ( pack ( ** kwargs ) , process_title2 ) ) , ( 'title4' , ( pack ( '//dc:title/node()' , title1 = '//dc:title/node()' ) , process_title ) ) ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# results = [ self . harvester . normalize ( record ) for record in self . harvester . harvest ( days_back = 1 ) ] #NEWLINE# for result in results : #NEWLINE# #INDENT# assert ( result [ 'title' ] == 'TestTest' ) #NEWLINE# assert ( result [ 'otherProperties' ] [ 0 ] [ 'properties' ] [ 'title2' ] == 'Testtest' ) #NEWLINE# assert ( result [ 'otherProperties' ] [ 1 ] [ 'properties' ] [ 'title3' ] == 'Test' ) #NEWLINE# assert ( result [ 'otherProperties' ] [ 2 ] [ 'properties' ] [ 'title4' ] == 'TestTest' )