#NEWLINE# def test_scalar_via_lazyload_with_active( self ) : #NEWLINE# #INDENT# class Foo ( fixtures . BasicEntity ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# lazy_load = None #NEWLINE# def lazyload( state , passive ) : #NEWLINE# #INDENT# return lazy_load #NEWLINE# #UNINDENT# instrumentation . register_class ( Foo ) #NEWLINE# attributes . register_attribute ( Foo , 'bar' , uselist = False , callable_ = lazyload , useobject = False , active_history = True ) #NEWLINE# lazy_load = 'hi' #NEWLINE# f = Foo ( ) #NEWLINE# eq_ ( f . bar , 'hi' ) #NEWLINE# eq_ ( attributes . get_state_history ( attributes . instance_state ( f ) , 'bar' ) , ( ( ) , [ 'hi' ] , ( ) ) ) #NEWLINE# f = Foo ( ) #NEWLINE# f . bar = None #NEWLINE# eq_ ( attributes . get_state_history ( attributes . instance_state ( f ) , 'bar' ) , ( [ None ] , ( ) , [ 'hi' ] ) ) #NEWLINE# f = Foo ( ) #NEWLINE# f . bar = 'there' #NEWLINE# eq_ ( attributes . get_state_history ( attributes . instance_state ( f ) , 'bar' ) , ( [ 'there' ] , ( ) , [ 'hi' ] ) ) #NEWLINE# f . bar = 'hi' #NEWLINE# eq_ ( attributes . get_state_history ( attributes . instance_state ( f ) , 'bar' ) , ( ( ) , [ 'hi' ] , ( ) ) ) #NEWLINE# f = Foo ( ) #NEWLINE# eq_ ( f . bar , 'hi' ) #NEWLINE# del f . bar #NEWLINE# eq_ ( attributes . get_state_history ( attributes . instance_state ( f ) , 'bar' ) , ( ( ) , ( ) , [ 'hi' ] ) ) #NEWLINE# assert ( f . bar is None ) #NEWLINE# eq_ ( attributes . get_state_history ( attributes . instance_state ( f ) , 'bar' ) , ( ( ) , ( ) , [ 'hi' ] ) )