#NEWLINE# @ scenario ( prepare_data , cleanup_data ) #NEWLINE# def test_wrappers( context ) : #NEWLINE# #INDENT# '\n    Search with wrapped match_all query\n    ' #NEWLINE# t = QuerySet ( 'localhost' , index = 'foo' ) #NEWLINE# add_document ( 'foo' , { #NEWLINE# #INDENT# 'bar' : 1 , #NEWLINE# #UNINDENT# } ) #NEWLINE# add_document ( 'foo' , { #NEWLINE# #INDENT# 'bar' : 2 , #NEWLINE# #UNINDENT# } ) #NEWLINE# add_document ( 'foo' , { #NEWLINE# #INDENT# 'bar' : 3 , #NEWLINE# #UNINDENT# } ) #NEWLINE# def wrapper_function( search_results ) : #NEWLINE# #INDENT# return list ( map ( ( lambda x : ( x [ '_source' ] [ 'bar' ] + 1 ) ) , search_results ) ) #NEWLINE# #UNINDENT# t . wrappers ( results ) #NEWLINE# t . order_by ( Sort ( 'bar' , order = 'asc' ) ) #NEWLINE# results = t [ 0 : 10 ] #NEWLINE# len ( results ) . should . equal ( 3 ) #NEWLINE# results [ 0 ] . should . equal ( 2 ) #NEWLINE# results [ 1 ] . should . equal ( 3 ) #NEWLINE# results [ 2 ] . should . equal ( 4 )