<s> """<STR_LIT>""" <EOL> from sqlalchemy import testing <EOL> from sqlalchemy . orm import mapper , relationship , create_session , immediateload <EOL> from sqlalchemy . testing import eq_ <EOL> from test . orm import _fixtures <EOL> class ImmediateTest ( _fixtures . FixtureTest ) : <EOL> run_inserts = '<STR_LIT>' <EOL> run_deletes = None <EOL> def test_basic_option ( self ) : <EOL> Address , addresses , users , User = ( self . classes . Address , <EOL> self . tables . addresses , <EOL> self . tables . users , <EOL> self . classes . User ) <EOL> mapper ( Address , addresses ) <EOL> mapper ( User , users , properties = { <EOL> '<STR_LIT>' : relationship ( Address ) <EOL> } ) <EOL> sess = create_session ( ) <EOL> l = sess . query ( User ) . options ( immediateload ( User . addresses ) ) . filter ( users . c . id == <NUM_LIT:7> ) . all ( ) <EOL> eq_ ( len ( sess . identity_map ) , <NUM_LIT:2> ) <EOL> sess . close ( ) <EOL> eq_ ( <EOL> [ User ( id = <NUM_LIT:7> , addresses = [ Address ( id = <NUM_LIT:1> , email_address = '<STR_LIT>' ) ] ) ] , <EOL> l <EOL> ) <EOL> def test_basic ( self ) : <EOL> Address , addresses , users , User = ( self . classes . Address , <EOL> self . tables . addresses , <EOL> self . tables . users , <EOL> self . classes . User ) <EOL> mapper ( Address , addresses ) <EOL> mapper ( User , users , properties = { <EOL> '<STR_LIT>' : relationship ( Address , lazy = '<STR_LIT>' ) <EOL> } ) <EOL> sess = create_session ( ) <EOL> l = sess . query ( User ) . filter ( users . c . id == <NUM_LIT:7> ) . all ( ) <EOL> eq_ ( len ( sess . identity_map ) , <NUM_LIT:2> ) <EOL> sess . close ( ) <EOL> eq_ ( <EOL> [ User ( id = <NUM_LIT:7> , addresses = [ Address ( id = <NUM_LIT:1> , email_address = '<STR_LIT>' ) ] ) ] , <EOL> l <EOL> ) </s>
