#NEWLINE# def test_load_only( self ) : #NEWLINE# #INDENT# session = self . session ( ) #NEWLINE# query = session . query ( self . model ) #NEWLINE# s = ( yield query . load_only ( 'name' , 'data__pv' ) . get ( name = 'a' ) ) #NEWLINE# self . assertEqual ( s . name , 'a' ) #NEWLINE# self . assertEqual ( s . data__pv , 0.5 ) #NEWLINE# self . assertFalse ( session . has_all_data ) #NEWLINE# self . assertEqual ( s . get_state ( ) . action , 'update' ) #NEWLINE# s . data = { #NEWLINE# #INDENT# 'pv' : { #NEWLINE# #INDENT# 'mean' : 2 , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# with session . begin ( ) as t : #NEWLINE# #INDENT# t . add ( s ) #NEWLINE# #UNINDENT# ( yield t . on_result ) #NEWLINE# s = ( yield query . get ( name = 'a' ) ) #NEWLINE# self . assertTrue ( s . has_all_data ) #NEWLINE# self . assertEqual ( s . data , { #NEWLINE# #INDENT# 'pv' : { #NEWLINE# #INDENT# '' : 0.5 , #NEWLINE# 'mean' : 2 , #NEWLINE# 'std' : 3.5 , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } )