#NEWLINE# def test_raw_dataset( self ) : #NEWLINE# #INDENT# params = { #NEWLINE# #INDENT# 'title' : 'My entry 1' , #NEWLINE# 'content' : 'My content 1.' , #NEWLINE# 'tags' : 'zinnia, test' , #NEWLINE# 'slug' : 'my-entry-1' , #NEWLINE# #UNINDENT# } #NEWLINE# Entry . objects . create ( ** params ) #NEWLINE# params = { #NEWLINE# #INDENT# 'title' : 'My entry 2' , #NEWLINE# 'content' : 'My content 2.' , #NEWLINE# 'tags' : 'zinnia, test' , #NEWLINE# 'slug' : 'my-entry-2' , #NEWLINE# #UNINDENT# } #NEWLINE# Entry . objects . create ( ** params ) #NEWLINE# v = ModelVectorBuilder ( queryset = Entry . objects . all ( ) , fields = [ 'title' ] ) #NEWLINE# with self . assertNumQueries ( 1 ) : #NEWLINE# #INDENT# self . assertEqual ( len ( v . raw_dataset ) , 2 ) #NEWLINE# self . assertEqual ( sorted ( v . raw_dataset . values ( ) ) , [ [ 'entry' ] , [ 'entry' ] ] ) #NEWLINE# #UNINDENT# v = ModelVectorBuilder ( queryset = Entry . objects . all ( ) , fields = [ 'title' , 'content' , 'tags' ] ) #NEWLINE# self . assertEqual ( sorted ( v . raw_dataset . values ( ) ) , [ [ 'entry' , 'content' , 'zinnia' , 'test' ] , [ 'entry' , 'content' , 'zinnia' , 'test' ] ] ) #NEWLINE# v = ModelVectorBuilder ( queryset = Entry . objects . all ( ) . order_by ( '-pk' ) , fields = [ 'title' ] , limit = 1 ) #NEWLINE# self . assertEqual ( list ( v . raw_dataset . values ( ) ) , [ [ 'entry' ] ] )