#NEWLINE# def test_global_scoped_session( self ) : #NEWLINE# #INDENT# global __session__ #NEWLINE# engine = create_engine ( 'sqlite://' ) #NEWLINE# session = scoped_session ( sessionmaker ( bind = engine ) ) #NEWLINE# __session__ = session #NEWLINE# class Person ( Entity ) : #NEWLINE# #INDENT# name = Field ( String ( 30 ) ) #NEWLINE# #UNINDENT# setup_all ( ) #NEWLINE# create_all ( engine ) #NEWLINE# homer = Person ( name = 'Homer' ) #NEWLINE# bart = Person ( name = 'Bart' ) #NEWLINE# session . commit ( ) #NEWLINE# assert ( Person . query . session is session ( ) ) #NEWLINE# assert ( Person . query . filter_by ( name = 'Homer' ) . one ( ) is homer ) #NEWLINE# del __session__