#NEWLINE# def test_list( self ) : #NEWLINE# #INDENT# class User ( object ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# class Address ( object ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# instrumentation . register_class ( User ) #NEWLINE# instrumentation . register_class ( Address ) #NEWLINE# attributes . register_attribute ( User , 'user_id' , uselist = False , useobject = False ) #NEWLINE# attributes . register_attribute ( User , 'user_name' , uselist = False , useobject = False ) #NEWLINE# attributes . register_attribute ( User , 'addresses' , uselist = True , useobject = True ) #NEWLINE# attributes . register_attribute ( Address , 'address_id' , uselist = False , useobject = False ) #NEWLINE# attributes . register_attribute ( Address , 'email_address' , uselist = False , useobject = False ) #NEWLINE# u = User ( ) #NEWLINE# u . user_id = 7 #NEWLINE# u . user_name = 'john' #NEWLINE# u . addresses = [ ] #NEWLINE# a = Address ( ) #NEWLINE# a . address_id = 10 #NEWLINE# a . email_address = 'lala@123.com' #NEWLINE# u . addresses . append ( a ) #NEWLINE# self . assert_ ( ( ( u . user_id == 7 ) and ( u . user_name == 'john' ) and ( u . addresses [ 0 ] . email_address == 'lala@123.com' ) ) ) #NEWLINE# ( u , attributes . instance_state ( a ) . _commit_all ( attributes . instance_dict ( a ) ) ) #NEWLINE# self . assert_ ( ( ( u . user_id == 7 ) and ( u . user_name == 'john' ) and ( u . addresses [ 0 ] . email_address == 'lala@123.com' ) ) ) #NEWLINE# u . user_name = 'heythere' #NEWLINE# a = Address ( ) #NEWLINE# a . address_id = 11 #NEWLINE# a . email_address = 'foo@bar.com' #NEWLINE# u . addresses . append ( a ) #NEWLINE# eq_ ( u . user_id , 7 ) #NEWLINE# eq_ ( u . user_name , 'heythere' ) #NEWLINE# eq_ ( u . addresses [ 0 ] . email_address , 'lala@123.com' ) #NEWLINE# eq_ ( u . addresses [ 1 ] . email_address , 'foo@bar.com' )