#NEWLINE# def test_mapper( self ) : #NEWLINE# #INDENT# mapper = Mapper ( mock_mapper , [ [ 'agent' ] ] ) #NEWLINE# output = list ( mapper ( 0 , 'bogus value' ) ) #NEWLINE# expected = [ ] #NEWLINE# expected += [ ( ( '20090618' , [ 'agent' ] , { #NEWLINE# #INDENT# 'agent' : 'firefox' , #NEWLINE# #UNINDENT# } , 'hit' ) , 1 ) ] #NEWLINE# expected += [ ( ( '20090618' , [ 'agent' ] , { #NEWLINE# #INDENT# 'agent' : 'all' , #NEWLINE# #UNINDENT# } , 'hit' ) , 1 ) ] #NEWLINE# self . assertEqual ( output , expected ) #NEWLINE# mapper = Mapper ( mock_mapper , [ [ 'agent' , 'path' ] , [ 'path' ] , [ 'agent' ] ] ) #NEWLINE# output = list ( mapper ( 0 , 'bogus value' ) ) #NEWLINE# expected = [ ] #NEWLINE# expected += [ ( ( '20090618' , [ 'agent' , 'path' ] , { #NEWLINE# #INDENT# 'path' : '/about' , #NEWLINE# 'agent' : 'firefox' , #NEWLINE# #UNINDENT# } , 'hit' ) , 1 ) ] #NEWLINE# expected += [ ( ( '20090618' , [ 'agent' , 'path' ] , { #NEWLINE# #INDENT# 'path' : '/about' , #NEWLINE# 'agent' : 'all' , #NEWLINE# #UNINDENT# } , 'hit' ) , 1 ) ] #NEWLINE# expected += [ ( ( '20090618' , [ 'agent' , 'path' ] , { #NEWLINE# #INDENT# 'path' : 'all' , #NEWLINE# 'agent' : 'firefox' , #NEWLINE# #UNINDENT# } , 'hit' ) , 1 ) ] #NEWLINE# expected += [ ( ( '20090618' , [ 'agent' , 'path' ] , { #NEWLINE# #INDENT# 'path' : 'all' , #NEWLINE# 'agent' : 'all' , #NEWLINE# #UNINDENT# } , 'hit' ) , 1 ) ] #NEWLINE# expected += [ ( ( '20090618' , [ 'path' ] , { #NEWLINE# #INDENT# 'path' : '/about' , #NEWLINE# #UNINDENT# } , 'hit' ) , 1 ) ] #NEWLINE# expected += [ ( ( '20090618' , [ 'path' ] , { #NEWLINE# #INDENT# 'path' : 'all' , #NEWLINE# #UNINDENT# } , 'hit' ) , 1 ) ] #NEWLINE# expected += [ ( ( '20090618' , [ 'agent' ] , { #NEWLINE# #INDENT# 'agent' : 'firefox' , #NEWLINE# #UNINDENT# } , 'hit' ) , 1 ) ] #NEWLINE# expected += [ ( ( '20090618' , [ 'agent' ] , { #NEWLINE# #INDENT# 'agent' : 'all' , #NEWLINE# #UNINDENT# } , 'hit' ) , 1 ) ] #NEWLINE# self . assertEqual ( expected , expected )