#NEWLINE# def test_iterator_offset( self ) : #NEWLINE# #INDENT# resultset = self . conn . search ( Search ( MatchAllQuery ( ) , start = 10 , size = 10 , sort = { #NEWLINE# #INDENT# 'position' : { #NEWLINE# #INDENT# 'order' : 'asc' , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } ) , self . index_name , self . document_type , start = 10 , size = 10 ) #NEWLINE# self . assertGreater ( resultset . took , 0.0 ) #NEWLINE# self . assertEqual ( len ( resultset ) , 1000 ) #NEWLINE# position = 0 #NEWLINE# for r in resultset : #NEWLINE# #INDENT# self . assertEqual ( r . position , ( position + 10 ) ) #NEWLINE# position += 1 #NEWLINE# #UNINDENT# range = resultset [ 0 : 1 ] #NEWLINE# self . assertEqual ( len ( range ) , 1 ) #NEWLINE# self . assertEqual ( range [ 0 ] . position , 10 ) #NEWLINE# range = resultset [ 1 : 1 ] #NEWLINE# self . assertEqual ( len ( range ) , 0 ) #NEWLINE# range = resultset [ 9 : 10 ] #NEWLINE# self . assertEqual ( len ( range ) , 1 ) #NEWLINE# self . assertEqual ( range [ 0 ] . position , 19 )