#NEWLINE# def test_lazyload( self ) : #NEWLINE# #INDENT# "test that a 'set' can be used as a collection and can lazyload." #NEWLINE# ( someothertable , sometable ) = ( self . tables . someothertable , self . tables . sometable ) #NEWLINE# class Foo ( object ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# class Bar ( object ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# mapper ( Foo , sometable , properties = { #NEWLINE# #INDENT# 'bars' : relationship ( Bar , collection_class = set ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# mapper ( Bar , someothertable ) #NEWLINE# f = Foo ( ) #NEWLINE# f . bars . add ( Bar ( ) ) #NEWLINE# f . bars . add ( Bar ( ) ) #NEWLINE# sess = create_session ( ) #NEWLINE# sess . add ( f ) #NEWLINE# sess . flush ( ) #NEWLINE# sess . expunge_all ( ) #NEWLINE# f = sess . query ( Foo ) . get ( f . col1 ) #NEWLINE# assert ( len ( list ( f . bars ) ) == 2 ) #NEWLINE# f . bars . clear ( )