#NEWLINE# def test_two( self ) : #NEWLINE# #INDENT# ( admins , users , roles , user_roles ) = ( self . tables . admins , self . tables . users , self . tables . roles , self . tables . user_roles ) #NEWLINE# class User ( object ) : #NEWLINE# #INDENT# def __init__( self , email = None , password = None ) : #NEWLINE# #INDENT# self . email = email #NEWLINE# self . password = password #NEWLINE# #UNINDENT# #UNINDENT# class Role ( object ) : #NEWLINE# #INDENT# def __init__( self , description = None ) : #NEWLINE# #INDENT# self . description = description #NEWLINE# #UNINDENT# #UNINDENT# class Admin ( User ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# role_mapper = mapper ( Role , roles ) #NEWLINE# user_mapper = mapper ( User , users , properties = { #NEWLINE# #INDENT# 'roles' : relationship ( Role , secondary = user_roles , lazy = 'joined' ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# admin_mapper = mapper ( Admin , admins , inherits = user_mapper ) #NEWLINE# adminrole = Role ( 'admin' ) #NEWLINE# sess = create_session ( ) #NEWLINE# sess . add ( adminrole ) #NEWLINE# sess . flush ( ) #NEWLINE# a = Admin ( email = 'tim' , password = 'admin' ) #NEWLINE# a . roles . append ( adminrole ) #NEWLINE# sess . add ( a ) #NEWLINE# sess . flush ( ) #NEWLINE# a . password = 'sadmin' #NEWLINE# sess . flush ( ) #NEWLINE# assert ( user_roles . count ( ) . scalar ( ) == 1 )