#NEWLINE# def test_column_dataset( self ) : #NEWLINE# #INDENT# vectors = ModelVectorBuilder ( queryset = Entry . objects . all ( ) , fields = [ 'title' , 'excerpt' , 'content' ] ) #NEWLINE# with self . assertNumQueries ( 1 ) : #NEWLINE# #INDENT# self . assertEqual ( vectors . dataset , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertEqual ( vectors . columns , [ ] ) #NEWLINE# #UNINDENT# params = { #NEWLINE# #INDENT# 'title' : 'My entry 1 (01)' , #NEWLINE# 'content' : 'This is my first content 1 (01)' , #NEWLINE# 'slug' : 'my-entry-1' , #NEWLINE# #UNINDENT# } #NEWLINE# e1 = Entry . objects . create ( ** params ) #NEWLINE# params = { #NEWLINE# #INDENT# 'title' : 'My entry 2 (02)' , #NEWLINE# 'content' : 'My second content entry 2 (02)' , #NEWLINE# 'slug' : 'my-entry-2' , #NEWLINE# #UNINDENT# } #NEWLINE# e2 = Entry . objects . create ( ** params ) #NEWLINE# vectors = ModelVectorBuilder ( queryset = Entry . objects . all ( ) , fields = [ 'title' , 'excerpt' , 'content' ] ) #NEWLINE# self . assertEqual ( vectors . columns , [ '01' , '02' , 'content' , 'entry' ] ) #NEWLINE# self . assertEqual ( vectors . dataset [ e1 . pk ] , [ 2 , 0 , 1 , 1 ] ) #NEWLINE# self . assertEqual ( vectors . dataset [ e2 . pk ] , [ 0 , 2 , 1 , 2 ] )