<s> from sqlalchemy . testing import eq_ , assert_raises , assert_raises_message , is_ <EOL> from sqlalchemy . testing import fixtures <EOL> from sqlalchemy import Integer , String , ForeignKey , or_ , exc , select , func , Boolean , case , text , column <EOL> from sqlalchemy . orm import mapper , relationship , backref , Session , joinedload , synonym , query <EOL> from sqlalchemy import testing <EOL> from sqlalchemy . testing import mock <EOL> from sqlalchemy . testing . schema import Table , Column <EOL> class UpdateDeleteTest ( fixtures . MappedTest ) : <EOL> __backend__ = True <EOL> @ classmethod <EOL> def define_tables ( cls , metadata ) : <EOL> Table ( '<STR_LIT>' , metadata , <EOL> Column ( '<STR_LIT:id>' , Integer , primary_key = True , <EOL> test_needs_autoincrement = True ) , <EOL> Column ( '<STR_LIT:name>' , String ( <NUM_LIT:32> ) ) , <EOL> Column ( '<STR_LIT>' , Integer ) ) <EOL> Table ( <EOL> "<STR_LIT>" , metadata , <EOL> Column ( '<STR_LIT:id>' , Integer , primary_key = True ) , <EOL> Column ( '<STR_LIT>' , ForeignKey ( '<STR_LIT>' ) ) <EOL> ) <EOL> @ classmethod <EOL> def setup_classes ( cls ) : <EOL> class User ( cls . Comparable ) : <EOL> pass <EOL> class Address ( cls . Comparable ) : <EOL> pass <EOL> @ classmethod <EOL> def insert_data ( cls ) : <EOL> users = cls . tables . users <EOL> users . insert ( ) . execute ( [ <EOL> dict ( id = <NUM_LIT:1> , name = '<STR_LIT>' , age_int = <NUM_LIT> ) , <EOL> dict ( id = <NUM_LIT:2> , name = '<STR_LIT>' , age_int = <NUM_LIT> ) , <EOL> dict ( id = <NUM_LIT:3> , name = '<STR_LIT>' , age_int = <NUM_LIT> ) , <EOL> dict ( id = <NUM_LIT:4> , name = '<STR_LIT>' , age_int = <NUM_LIT> ) , <EOL> ] ) <EOL> @ classmethod <EOL> def setup_mappers ( cls ) : <EOL> User = cls . classes . User <EOL> users = cls . tables . users <EOL> Address = cls . classes . Address <EOL> addresses = cls . tables . addresses <EOL> mapper ( User , users , properties = { <EOL> '<STR_LIT>' : users . c . age_int , <EOL> '<STR_LIT>' : relationship ( Address ) <EOL> } ) <EOL> mapper ( Address , addresses ) <EOL> def test_illegal_eval ( self ) : <EOL> User = self . classes . User <EOL> s = Session ( ) <EOL> assert_raises_message ( <EOL> exc . ArgumentError , <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" , <EOL> s . query ( User ) . update , <EOL> { } , <EOL> synchronize_session = "<STR_LIT>" <EOL> ) <EOL> def test_illegal_operations ( self ) : <EOL> User = self . classes . User <EOL> Address = self . classes . Address <EOL> s = Session ( ) <EOL> for q , mname in ( <EOL> ( s . query ( User ) . limit ( <NUM_LIT:2> ) , r"<STR_LIT>" ) , <EOL> ( s . query ( User ) . offset ( <NUM_LIT:2> ) , r"<STR_LIT>" ) , <EOL> ( s . query ( User ) . limit ( <NUM_LIT:2> ) . offset ( <NUM_LIT:2> ) , r"<STR_LIT>" ) , <EOL> ( s . query ( User ) . order_by ( User . id ) , r"<STR_LIT>" ) , <EOL> ( s . query ( User ) . group_by ( User . id ) , r"<STR_LIT>" ) , <EOL> ( s . query ( User ) . distinct ( ) , r"<STR_LIT>" ) , <EOL> ( s . query ( User ) . join ( User . addresses ) , <EOL> r"<STR_LIT>" ) , <EOL> ( s . query ( User ) . outerjoin ( User . addresses ) , <EOL> r"<STR_LIT>" ) , <EOL> ( s . query ( User ) . select_from ( Address ) , <EOL> r"<STR_LIT>" ) , <EOL> ( s . query ( User ) . from_self ( ) , <EOL> r"<STR_LIT>" ) , <EOL> ) : <EOL> assert_raises_message ( <EOL> exc . InvalidRequestError , <EOL> r"<STR_LIT>" <EOL> "<STR_LIT>" % mname , <EOL> q . update , <EOL> { '<STR_LIT:name>' : '<STR_LIT>' } ) <EOL> assert_raises_message ( <EOL> exc . InvalidRequestError , <EOL> r"<STR_LIT>" <EOL> "<STR_LIT>" % mname , <EOL> q . delete ) <EOL> def test_evaluate_clauseelement ( self ) : <EOL> User = self . classes . User <EOL> class Thing ( object ) : <EOL> def __clause_element__ ( self ) : <EOL> return User . name . __clause_element__ ( ) <EOL> s = Session ( ) <EOL> jill = s . query ( User ) . get ( <NUM_LIT:3> ) <EOL> s . query ( User ) . update ( <EOL> { Thing ( ) : '<STR_LIT>' } , <EOL> synchronize_session = '<STR_LIT>' ) <EOL> eq_ ( jill . name , '<STR_LIT>' ) <EOL> def test_evaluate_invalid ( self ) : <EOL> User = self . classes . User <EOL> class Thing ( object ) : <EOL> def __clause_element__ ( self ) : <EOL> return <NUM_LIT:5> <EOL> s = Session ( ) <EOL> assert_raises_message ( <EOL> exc . InvalidRequestError , <EOL> "<STR_LIT>" , <EOL> s . query ( User ) . update , { Thing ( ) : '<STR_LIT>' } , <EOL> synchronize_session = '<STR_LIT>' <EOL> ) <EOL> def test_evaluate_unmapped_col ( self ) : <EOL> User = self . classes . User <EOL> s = Session ( ) <EOL> jill = s . query ( User ) . get ( <NUM_LIT:3> ) <EOL> s . query ( User ) . update ( <EOL> { column ( '<STR_LIT:name>' ) : '<STR_LIT>' } , <EOL> synchronize_session = '<STR_LIT>' ) <EOL> eq_ ( jill . name , '<STR_LIT>' ) <EOL> s . expire ( jill ) <EOL> eq_ ( jill . name , '<STR_LIT>' ) <EOL> def test_evaluate_synonym_string ( self ) : <EOL> class Foo ( object ) : <EOL> pass <EOL> mapper ( Foo , self . tables . users , properties = { <EOL> '<STR_LIT>' : synonym ( "<STR_LIT:name>" , ) <EOL> } ) <EOL> s = Session ( ) <EOL> jill = s . query ( Foo ) . get ( <NUM_LIT:3> ) <EOL> s . query ( Foo ) . update ( <EOL> { '<STR_LIT>' : '<STR_LIT>' } , <EOL> synchronize_session = '<STR_LIT>' ) <EOL> eq_ ( jill . uname , '<STR_LIT>' ) <EOL> def test_evaluate_synonym_attr ( self ) : <EOL> class Foo ( object ) : <EOL> pass <EOL> mapper ( Foo , self . tables . users , properties = { <EOL> '<STR_LIT>' : synonym ( "<STR_LIT:name>" , ) <EOL> } ) <EOL> s = Session ( ) <EOL> jill = s . query ( Foo ) . get ( <NUM_LIT:3> ) <EOL> s . query ( Foo ) . update ( <EOL> { Foo . uname : '<STR_LIT>' } , <EOL> synchronize_session = '<STR_LIT>' ) <EOL> eq_ ( jill . uname , '<STR_LIT>' ) <EOL> def test_evaluate_double_synonym_attr ( self ) : <EOL> class Foo ( object ) : <EOL> pass <EOL> mapper ( Foo , self . tables . users , properties = { <EOL> '<STR_LIT>' : synonym ( "<STR_LIT:name>" ) , <EOL> '<STR_LIT>' : synonym ( '<STR_LIT>' ) <EOL> } ) <EOL> s = Session ( ) <EOL> jill = s . query ( Foo ) . get ( <NUM_LIT:3> ) <EOL> s . query ( Foo ) . update ( <EOL> { Foo . ufoo : '<STR_LIT>' } , <EOL> synchronize_session = '<STR_LIT>' ) <EOL> eq_ ( jill . ufoo , '<STR_LIT>' ) <EOL> def test_evaluate_hybrid_attr ( self ) : <EOL> from sqlalchemy . ext . hybrid import hybrid_property <EOL> class Foo ( object ) : <EOL> @ hybrid_property <EOL> def uname ( self ) : <EOL> return self . name <EOL> mapper ( Foo , self . tables . users ) <EOL> s = Session ( ) <EOL> jill = s . query ( Foo ) . get ( <NUM_LIT:3> ) <EOL> s . query ( Foo ) . update ( <EOL> { Foo . uname : '<STR_LIT>' } , <EOL> synchronize_session = '<STR_LIT>' ) <EOL> eq_ ( jill . uname , '<STR_LIT>' ) <EOL> def test_delete ( self ) : <EOL> User = self . classes . User <EOL> sess = Session ( ) <EOL> john , jack , jill , jane = sess . query ( User ) . order_by ( User . id ) . all ( ) <EOL> sess . query ( User ) . filter ( <EOL> or_ ( User . name == '<STR_LIT>' , User . name == '<STR_LIT>' ) ) . delete ( ) <EOL> assert john not in sess and jill not in sess <EOL> eq_ ( sess . query ( User ) . order_by ( User . id ) . all ( ) , [ jack , jane ] ) <EOL> def test_delete_against_metadata ( self ) : <EOL> User = self . classes . User <EOL> users = self . tables . users <EOL> sess = Session ( ) <EOL> sess . query ( users ) . delete ( synchronize_session = False ) <EOL> eq_ ( sess . query ( User ) . count ( ) , <NUM_LIT:0> ) <EOL> def test_delete_with_bindparams ( self ) : <EOL> User = self . classes . User <EOL> sess = Session ( ) <EOL> john , jack , jill , jane = sess . query ( User ) . order_by ( User . id ) . all ( ) <EOL> sess . query ( User ) . filter ( text ( '<STR_LIT>' ) ) . params ( <EOL> name = '<STR_LIT>' ) . delete ( '<STR_LIT>' ) <EOL> assert john not in sess <EOL> eq_ ( sess . query ( User ) . order_by ( User . id ) . all ( ) , [ jack , jill , jane ] ) <EOL> def test_delete_rollback ( self ) : <EOL> User = self . classes . User <EOL> sess = Session ( ) <EOL> john , jack , jill , jane = sess . query ( User ) . order_by ( User . id ) . all ( ) <EOL> sess . query ( User ) . filter ( <EOL> or_ ( User . name == '<STR_LIT>' , User . name == '<STR_LIT>' ) ) . delete ( synchronize_session = '<STR_LIT>' ) <EOL> assert john not in sess and jill not in sess <EOL> sess . rollback ( ) <EOL> assert john in sess and jill in sess <EOL> def test_delete_rollback_with_fetch ( self ) : <EOL> User = self . classes . User <EOL> sess = Session ( ) <EOL> john , jack , jill , jane = sess . query ( User ) . order_by ( User . id ) . all ( ) <EOL> sess . query ( User ) . filter ( <EOL> or_ ( User . name == '<STR_LIT>' , User . name == '<STR_LIT>' ) ) . delete ( synchronize_session = '<STR_LIT>' ) <EOL> assert john not in sess and jill not in sess <EOL> sess . rollback ( ) <EOL> assert john in sess and jill in sess <EOL> def test_delete_without_session_sync ( self ) : <EOL> User = self . classes . User <EOL> sess = Session ( ) <EOL> john , jack , jill , jane = sess . query ( User ) . order_by ( User . id ) . all ( ) <EOL> sess . query ( User ) . filter ( <EOL> or_ ( User . name == '<STR_LIT>' , User . name == '<STR_LIT>' ) ) . delete ( synchronize_session = False ) <EOL> assert john in sess and jill in sess <EOL> eq_ ( sess . query ( User ) . order_by ( User . id ) . all ( ) , [ jack , jane ] ) <EOL> def test_delete_with_fetch_strategy ( self ) : <EOL> User = self . classes . User <EOL> sess = Session ( ) <EOL> john , jack , jill , jane = sess . query ( User ) . order_by ( User . id ) . all ( ) <EOL> sess . query ( User ) . filter ( <EOL> or_ ( User . name == '<STR_LIT>' , User . name == '<STR_LIT>' ) ) . delete ( synchronize_session = '<STR_LIT>' ) <EOL> assert john not in sess and jill not in sess <EOL> eq_ ( sess . query ( User ) . order_by ( User . id ) . all ( ) , [ jack , jane ] ) <EOL> @ testing . fails_on ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> def test_delete_invalid_evaluation ( self ) : <EOL> User = self . classes . User <EOL> sess = Session ( ) <EOL> john , jack , jill , jane = sess . query ( User ) . order_by ( User . id ) . all ( ) <EOL> assert_raises ( exc . InvalidRequestError , <EOL> sess . query ( User ) . <EOL> filter ( <EOL> User . name == select ( [ func . max ( User . name ) ] ) ) . delete , <EOL> synchronize_session = '<STR_LIT>' <EOL> ) <EOL> sess . query ( User ) . filter ( User . name == select ( [ func . max ( User . name ) ] ) ) . delete ( synchronize_session = '<STR_LIT>' ) <EOL> assert john not in sess <EOL> eq_ ( sess . query ( User ) . order_by ( User . id ) . all ( ) , [ jack , jill , jane ] ) <EOL> def test_update ( self ) : <EOL> User , users = self . classes . User , self . tables . users <EOL> sess = Session ( ) <EOL> john , jack , jill , jane = sess . query ( User ) . order_by ( User . id ) . all ( ) <EOL> sess . query ( User ) . filter ( User . age > <NUM_LIT> ) . update ( { '<STR_LIT>' : User . age - <NUM_LIT:10> } , synchronize_session = '<STR_LIT>' ) <EOL> eq_ ( [ john . age , jack . age , jill . age , jane . age ] , [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] ) <EOL> eq_ ( sess . query ( User . age ) . order_by ( <EOL> User . id ) . all ( ) , list ( zip ( [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] ) ) ) <EOL> sess . query ( User ) . filter ( User . age > <NUM_LIT> ) . update ( { User . age : User . age - <NUM_LIT:10> } , synchronize_session = '<STR_LIT>' ) <EOL> eq_ ( [ john . age , jack . age , jill . age , jane . age ] , [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] ) <EOL> eq_ ( sess . query ( User . age ) . order_by ( <EOL> User . id ) . all ( ) , list ( zip ( [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] ) ) ) <EOL> sess . query ( User ) . filter ( User . age > <NUM_LIT> ) . update ( <EOL> { users . c . age_int : User . age - <NUM_LIT:10> } , <EOL> synchronize_session = '<STR_LIT>' ) <EOL> eq_ ( [ john . age , jack . age , jill . age , jane . age ] , [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] ) <EOL> eq_ ( sess . query ( User . age ) . order_by ( <EOL> User . id ) . all ( ) , list ( zip ( [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] ) ) ) <EOL> sess . query ( User ) . filter ( User . age == <NUM_LIT> ) . update ( { User . age : User . age - <NUM_LIT:10> } , synchronize_session = '<STR_LIT>' ) <EOL> eq_ ( [ john . age , jack . age , jill . age , jane . age ] , [ <NUM_LIT:15> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] ) <EOL> eq_ ( sess . query ( User . age ) . order_by ( <EOL> User . id ) . all ( ) , list ( zip ( [ <NUM_LIT:15> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] ) ) ) <EOL> def test_update_against_table_col ( self ) : <EOL> User , users = self . classes . User , self . tables . users <EOL> sess = Session ( ) <EOL> john , jack , jill , jane = sess . query ( User ) . order_by ( User . id ) . all ( ) <EOL> eq_ ( [ john . age , jack . age , jill . age , jane . age ] , [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] ) <EOL> sess . query ( User ) . filter ( User . age > <NUM_LIT> ) . update ( <EOL> { users . c . age_int : User . age - <NUM_LIT:10> } , <EOL> synchronize_session = '<STR_LIT>' ) <EOL> eq_ ( [ john . age , jack . age , jill . age , jane . age ] , [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] ) <EOL> def test_update_against_metadata ( self ) : <EOL> User , users = self . classes . User , self . tables . users <EOL> sess = Session ( ) <EOL> sess . query ( users ) . update ( <EOL> { users . c . age_int : <NUM_LIT> } , synchronize_session = False ) <EOL> eq_ ( sess . query ( User . age ) . order_by ( <EOL> User . id ) . all ( ) , list ( zip ( [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] ) ) ) <EOL> def test_update_with_bindparams ( self ) : <EOL> User = self . classes . User <EOL> sess = Session ( ) <EOL> john , jack , jill , jane = sess . query ( User ) . order_by ( User . id ) . all ( ) <EOL> sess . query ( User ) . filter ( text ( '<STR_LIT>' ) ) . params ( x = <NUM_LIT> ) . update ( { '<STR_LIT>' : User . age - <NUM_LIT:10> } , synchronize_session = '<STR_LIT>' ) <EOL> eq_ ( [ john . age , jack . age , jill . age , jane . age ] , [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] ) <EOL> eq_ ( sess . query ( User . age ) . order_by ( <EOL> User . id ) . all ( ) , list ( zip ( [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] ) ) ) <EOL> def test_update_without_load ( self ) : <EOL> User = self . classes . User <EOL> sess = Session ( ) <EOL> sess . query ( User ) . filter ( User . id == <NUM_LIT:3> ) . update ( { '<STR_LIT>' : <NUM_LIT> } , synchronize_session = '<STR_LIT>' ) <EOL> eq_ ( sess . query ( User . age ) . order_by ( <EOL> User . id ) . all ( ) , list ( zip ( [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] ) ) ) <EOL> def test_update_changes_resets_dirty ( self ) : <EOL> User = self . classes . User <EOL> sess = Session ( autoflush = False ) <EOL> john , jack , jill , jane = sess . query ( User ) . order_by ( User . id ) . all ( ) <EOL> john . age = <NUM_LIT:50> <EOL> jack . age = <NUM_LIT> <EOL> sess . query ( User ) . filter ( User . age > <NUM_LIT> ) . update ( { '<STR_LIT>' : User . age - <NUM_LIT:10> } , synchronize_session = '<STR_LIT>' ) <EOL> for x in ( john , jack , jill , jane ) : <EOL> assert not sess . is_modified ( x ) <EOL> eq_ ( [ john . age , jack . age , jill . age , jane . age ] , [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] ) <EOL> john . age = <NUM_LIT> <EOL> assert john in sess . dirty <EOL> assert jack in sess . dirty <EOL> assert jill not in sess . dirty <EOL> assert not sess . is_modified ( john ) <EOL> assert not sess . is_modified ( jack ) <EOL> def test_update_changes_with_autoflush ( self ) : <EOL> User = self . classes . User <EOL> sess = Session ( ) <EOL> john , jack , jill , jane = sess . query ( User ) . order_by ( User . id ) . all ( ) <EOL> john . age = <NUM_LIT:50> <EOL> jack . age = <NUM_LIT> <EOL> sess . query ( User ) . filter ( User . age > <NUM_LIT> ) . update ( { '<STR_LIT>' : User . age - <NUM_LIT:10> } , synchronize_session = '<STR_LIT>' ) <EOL> for x in ( john , jack , jill , jane ) : <EOL> assert not sess . is_modified ( x ) <EOL> eq_ ( [ john . age , jack . age , jill . age , jane . age ] , [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] ) <EOL> john . age = <NUM_LIT> <EOL> assert john in sess . dirty <EOL> assert jack not in sess . dirty <EOL> assert jill not in sess . dirty <EOL> assert sess . is_modified ( john ) <EOL> assert not sess . is_modified ( jack ) <EOL> def test_update_with_expire_strategy ( self ) : <EOL> User = self . classes . User <EOL> sess = Session ( ) <EOL> john , jack , jill , jane = sess . query ( User ) . order_by ( User . id ) . all ( ) <EOL> sess . query ( User ) . filter ( User . age > <NUM_LIT> ) . update ( { '<STR_LIT>' : User . age - <NUM_LIT:10> } , synchronize_session = '<STR_LIT>' ) <EOL> eq_ ( [ john . age , jack . age , jill . age , jane . age ] , [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] ) <EOL> eq_ ( sess . query ( User . age ) . order_by ( <EOL> User . id ) . all ( ) , list ( zip ( [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] ) ) ) <EOL> @ testing . fails_if ( lambda : not testing . db . dialect . supports_sane_rowcount ) <EOL> def test_update_returns_rowcount ( self ) : <EOL> User = self . classes . User <EOL> sess = Session ( ) <EOL> rowcount = sess . query ( User ) . filter ( <EOL> User . age > <NUM_LIT> ) . update ( { '<STR_LIT>' : User . age + <NUM_LIT:0> } ) <EOL> eq_ ( rowcount , <NUM_LIT:2> ) <EOL> rowcount = sess . query ( User ) . filter ( <EOL> User . age > <NUM_LIT> ) . update ( { '<STR_LIT>' : User . age - <NUM_LIT:10> } ) <EOL> eq_ ( rowcount , <NUM_LIT:2> ) <EOL> @ testing . fails_if ( lambda : not testing . db . dialect . supports_sane_rowcount ) <EOL> def test_delete_returns_rowcount ( self ) : <EOL> User = self . classes . User <EOL> sess = Session ( ) <EOL> rowcount = sess . query ( User ) . filter ( User . age > <NUM_LIT> ) . delete ( synchronize_session = False ) <EOL> eq_ ( rowcount , <NUM_LIT:3> ) <EOL> def test_update_all ( self ) : <EOL> User = self . classes . User <EOL> sess = Session ( ) <EOL> john , jack , jill , jane = sess . query ( User ) . order_by ( User . id ) . all ( ) <EOL> sess . query ( User ) . update ( { '<STR_LIT>' : <NUM_LIT> } , synchronize_session = '<STR_LIT>' ) <EOL> eq_ ( [ john . age , jack . age , jill . age , jane . age ] , [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] ) <EOL> eq_ ( sess . query ( User . age ) . order_by ( <EOL> User . id ) . all ( ) , list ( zip ( [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] ) ) ) <EOL> def test_delete_all ( self ) : <EOL> User = self . classes . User <EOL> sess = Session ( ) <EOL> john , jack , jill , jane = sess . query ( User ) . order_by ( User . id ) . all ( ) <EOL> sess . query ( User ) . delete ( synchronize_session = '<STR_LIT>' ) <EOL> assert not ( <EOL> john in sess or jack in sess or jill in sess or jane in sess ) <EOL> eq_ ( sess . query ( User ) . count ( ) , <NUM_LIT:0> ) <EOL> def test_autoflush_before_evaluate_update ( self ) : <EOL> User = self . classes . User <EOL> sess = Session ( ) <EOL> john = sess . query ( User ) . filter_by ( name = '<STR_LIT>' ) . one ( ) <EOL> john . name = '<STR_LIT>' <EOL> sess . query ( User ) . filter_by ( name = '<STR_LIT>' ) . update ( { '<STR_LIT>' : <NUM_LIT> } , <EOL> synchronize_session = '<STR_LIT>' ) <EOL> eq_ ( john . age , <NUM_LIT> ) <EOL> def test_autoflush_before_fetch_update ( self ) : <EOL> User = self . classes . User <EOL> sess = Session ( ) <EOL> john = sess . query ( User ) . filter_by ( name = '<STR_LIT>' ) . one ( ) <EOL> john . name = '<STR_LIT>' <EOL> sess . query ( User ) . filter_by ( name = '<STR_LIT>' ) . update ( { '<STR_LIT>' : <NUM_LIT> } , <EOL> synchronize_session = '<STR_LIT>' ) <EOL> eq_ ( john . age , <NUM_LIT> ) <EOL> def test_autoflush_before_evaluate_delete ( self ) : <EOL> User = self . classes . User <EOL> sess = Session ( ) <EOL> john = sess . query ( User ) . filter_by ( name = '<STR_LIT>' ) . one ( ) <EOL> john . name = '<STR_LIT>' <EOL> sess . query ( User ) . filter_by ( name = '<STR_LIT>' ) . delete ( <EOL> synchronize_session = '<STR_LIT>' ) <EOL> assert john not in sess <EOL> def test_autoflush_before_fetch_delete ( self ) : <EOL> User = self . classes . User <EOL> sess = Session ( ) <EOL> john = sess . query ( User ) . filter_by ( name = '<STR_LIT>' ) . one ( ) <EOL> john . name = '<STR_LIT>' <EOL> sess . query ( User ) . filter_by ( name = '<STR_LIT>' ) . delete ( <EOL> synchronize_session = '<STR_LIT>' ) <EOL> assert john not in sess <EOL> def test_evaluate_before_update ( self ) : <EOL> User = self . classes . User <EOL> sess = Session ( ) <EOL> john = sess . query ( User ) . filter_by ( name = '<STR_LIT>' ) . one ( ) <EOL> sess . expire ( john , [ '<STR_LIT>' ] ) <EOL> sess . query ( User ) . filter_by ( name = '<STR_LIT>' ) . filter_by ( age = <NUM_LIT> ) . update ( { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT>' : <NUM_LIT> } , <EOL> synchronize_session = '<STR_LIT>' ) <EOL> eq_ ( john . name , '<STR_LIT>' ) <EOL> eq_ ( john . age , <NUM_LIT> ) <EOL> def test_fetch_before_update ( self ) : <EOL> User = self . classes . User <EOL> sess = Session ( ) <EOL> john = sess . query ( User ) . filter_by ( name = '<STR_LIT>' ) . one ( ) <EOL> sess . expire ( john , [ '<STR_LIT>' ] ) <EOL> sess . query ( User ) . filter_by ( name = '<STR_LIT>' ) . filter_by ( age = <NUM_LIT> ) . update ( { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT>' : <NUM_LIT> } , <EOL> synchronize_session = '<STR_LIT>' ) <EOL> eq_ ( john . name , '<STR_LIT>' ) <EOL> eq_ ( john . age , <NUM_LIT> ) <EOL> def test_evaluate_before_delete ( self ) : <EOL> User = self . classes . User <EOL> sess = Session ( ) <EOL> john = sess . query ( User ) . filter_by ( name = '<STR_LIT>' ) . one ( ) <EOL> sess . expire ( john , [ '<STR_LIT>' ] ) <EOL> sess . query ( User ) . filter_by ( name = '<STR_LIT>' ) . filter_by ( age = <NUM_LIT> ) . delete ( <EOL> synchronize_session = '<STR_LIT>' ) <EOL> assert john not in sess <EOL> def test_fetch_before_delete ( self ) : <EOL> User = self . classes . User <EOL> sess = Session ( ) <EOL> john = sess . query ( User ) . filter_by ( name = '<STR_LIT>' ) . one ( ) <EOL> sess . expire ( john , [ '<STR_LIT>' ] ) <EOL> sess . query ( User ) . filter_by ( name = '<STR_LIT>' ) . filter_by ( age = <NUM_LIT> ) . delete ( <EOL> synchronize_session = '<STR_LIT>' ) <EOL> assert john not in sess <EOL> def test_update_unordered_dict ( self ) : <EOL> User = self . classes . User <EOL> session = Session ( ) <EOL> with mock . patch . object ( session , "<STR_LIT>" ) as exec_ : <EOL> session . query ( User ) . filter ( User . id == <NUM_LIT:15> ) . update ( <EOL> { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT> } ) <EOL> params_type = type ( exec_ . mock_calls [ <NUM_LIT:0> ] [ <NUM_LIT:1> ] [ <NUM_LIT:0> ] . parameters ) <EOL> is_ ( params_type , dict ) <EOL> def test_update_preserve_parameter_order ( self ) : <EOL> User = self . classes . User <EOL> session = Session ( ) <EOL> with mock . patch . object ( session , "<STR_LIT>" ) as exec_ : <EOL> session . query ( User ) . filter ( User . id == <NUM_LIT:15> ) . update ( <EOL> ( ( '<STR_LIT:id>' , <NUM_LIT> ) , ( '<STR_LIT:name>' , '<STR_LIT>' ) ) , <EOL> update_args = { "<STR_LIT>" : True } ) <EOL> cols = [ c . key <EOL> for c in exec_ . mock_calls [ <NUM_LIT:0> ] [ <NUM_LIT:1> ] [ <NUM_LIT:0> ] . _parameter_ordering ] <EOL> eq_ ( [ '<STR_LIT:id>' , '<STR_LIT:name>' ] , cols ) <EOL> with mock . patch . object ( session , "<STR_LIT>" ) as exec_ : <EOL> session . query ( User ) . filter ( User . id == <NUM_LIT:15> ) . update ( <EOL> [ ( '<STR_LIT:name>' , '<STR_LIT>' ) , ( '<STR_LIT:id>' , <NUM_LIT> ) ] , <EOL> update_args = { "<STR_LIT>" : True } ) <EOL> cols = [ c . key <EOL> for c in exec_ . mock_calls [ <NUM_LIT:0> ] [ <NUM_LIT:1> ] [ <NUM_LIT:0> ] . _parameter_ordering ] <EOL> eq_ ( [ '<STR_LIT:name>' , '<STR_LIT:id>' ] , cols ) <EOL> class UpdateDeleteIgnoresLoadersTest ( fixtures . MappedTest ) : <EOL> @ classmethod <EOL> def define_tables ( cls , metadata ) : <EOL> Table ( '<STR_LIT>' , metadata , <EOL> Column ( '<STR_LIT:id>' , Integer , primary_key = True , <EOL> test_needs_autoincrement = True ) , <EOL> Column ( '<STR_LIT:name>' , String ( <NUM_LIT:32> ) ) , <EOL> Column ( '<STR_LIT>' , Integer ) ) <EOL> Table ( '<STR_LIT>' , metadata , <EOL> Column ( '<STR_LIT:id>' , Integer , primary_key = True , <EOL> test_needs_autoincrement = True ) , <EOL> Column ( '<STR_LIT>' , None , ForeignKey ( '<STR_LIT>' ) ) , <EOL> Column ( '<STR_LIT:title>' , String ( <NUM_LIT:32> ) ) ) <EOL> @ classmethod <EOL> def setup_classes ( cls ) : <EOL> class User ( cls . Comparable ) : <EOL> pass <EOL> class Document ( cls . Comparable ) : <EOL> pass <EOL> @ classmethod <EOL> def insert_data ( cls ) : <EOL> users = cls . tables . users <EOL> users . insert ( ) . execute ( [ <EOL> dict ( id = <NUM_LIT:1> , name = '<STR_LIT>' , age = <NUM_LIT> ) , <EOL> dict ( id = <NUM_LIT:2> , name = '<STR_LIT>' , age = <NUM_LIT> ) , <EOL> dict ( id = <NUM_LIT:3> , name = '<STR_LIT>' , age = <NUM_LIT> ) , <EOL> dict ( id = <NUM_LIT:4> , name = '<STR_LIT>' , age = <NUM_LIT> ) , <EOL> ] ) <EOL> documents = cls . tables . documents <EOL> documents . insert ( ) . execute ( [ <EOL> dict ( id = <NUM_LIT:1> , user_id = <NUM_LIT:1> , title = '<STR_LIT:foo>' ) , <EOL> dict ( id = <NUM_LIT:2> , user_id = <NUM_LIT:1> , title = '<STR_LIT:bar>' ) , <EOL> dict ( id = <NUM_LIT:3> , user_id = <NUM_LIT:2> , title = '<STR_LIT>' ) , <EOL> ] ) <EOL> @ classmethod <EOL> def setup_mappers ( cls ) : <EOL> documents , Document , User , users = ( cls . tables . documents , <EOL> cls . classes . Document , <EOL> cls . classes . User , <EOL> cls . tables . users ) <EOL> mapper ( User , users ) <EOL> mapper ( Document , documents , properties = { <EOL> '<STR_LIT:user>' : relationship ( User , lazy = '<STR_LIT>' , <EOL> backref = backref ( '<STR_LIT>' , lazy = '<STR_LIT>' ) ) <EOL> } ) <EOL> def test_update_with_eager_relationships ( self ) : <EOL> Document = self . classes . Document <EOL> sess = Session ( ) <EOL> foo , bar , baz = sess . query ( Document ) . order_by ( Document . id ) . all ( ) <EOL> sess . query ( Document ) . filter ( Document . user_id == <NUM_LIT:1> ) . update ( { '<STR_LIT:title>' : Document . title + Document . title } , <EOL> synchronize_session = '<STR_LIT>' ) <EOL> eq_ ( [ foo . title , bar . title , baz . title ] , [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> eq_ ( sess . query ( Document . title ) . order_by ( Document . id ) . all ( ) , <EOL> list ( zip ( [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) ) ) <EOL> def test_update_with_explicit_joinedload ( self ) : <EOL> User = self . classes . User <EOL> sess = Session ( ) <EOL> john , jack , jill , jane = sess . query ( User ) . order_by ( User . id ) . all ( ) <EOL> sess . query ( User ) . options ( <EOL> joinedload ( User . documents ) ) . filter ( User . age > <NUM_LIT> ) . update ( { '<STR_LIT>' : User . age - <NUM_LIT:10> } , synchronize_session = '<STR_LIT>' ) <EOL> eq_ ( [ john . age , jack . age , jill . age , jane . age ] , [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] ) <EOL> eq_ ( sess . query ( User . age ) . order_by ( <EOL> User . id ) . all ( ) , list ( zip ( [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] ) ) ) <EOL> def test_delete_with_eager_relationships ( self ) : <EOL> Document = self . classes . Document <EOL> sess = Session ( ) <EOL> sess . query ( Document ) . filter ( Document . user_id == <NUM_LIT:1> ) . delete ( synchronize_session = False ) <EOL> eq_ ( sess . query ( Document . title ) . all ( ) , list ( zip ( [ '<STR_LIT>' ] ) ) ) <EOL> class UpdateDeleteFromTest ( fixtures . MappedTest ) : <EOL> @ classmethod <EOL> def define_tables ( cls , metadata ) : <EOL> Table ( '<STR_LIT>' , metadata , <EOL> Column ( '<STR_LIT:id>' , Integer , primary_key = True ) , <EOL> Column ( '<STR_LIT>' , String ( <NUM_LIT:10> ) ) , <EOL> ) <EOL> Table ( '<STR_LIT>' , metadata , <EOL> Column ( '<STR_LIT:id>' , Integer , primary_key = True ) , <EOL> Column ( '<STR_LIT>' , None , ForeignKey ( '<STR_LIT>' ) ) , <EOL> Column ( '<STR_LIT:title>' , String ( <NUM_LIT:32> ) ) , <EOL> Column ( '<STR_LIT>' , Boolean ) , <EOL> Column ( '<STR_LIT>' , String ( <NUM_LIT:10> ) ) , <EOL> ) <EOL> @ classmethod <EOL> def setup_classes ( cls ) : <EOL> class User ( cls . Comparable ) : <EOL> pass <EOL> class Document ( cls . Comparable ) : <EOL> pass <EOL> @ classmethod <EOL> def insert_data ( cls ) : <EOL> users = cls . tables . users <EOL> users . insert ( ) . execute ( [ <EOL> dict ( id = <NUM_LIT:1> , ) , <EOL> dict ( id = <NUM_LIT:2> , ) , <EOL> dict ( id = <NUM_LIT:3> , ) , <EOL> dict ( id = <NUM_LIT:4> , ) , <EOL> ] ) <EOL> documents = cls . tables . documents <EOL> documents . insert ( ) . execute ( [ <EOL> dict ( id = <NUM_LIT:1> , user_id = <NUM_LIT:1> , title = '<STR_LIT:foo>' ) , <EOL> dict ( id = <NUM_LIT:2> , user_id = <NUM_LIT:1> , title = '<STR_LIT:bar>' ) , <EOL> dict ( id = <NUM_LIT:3> , user_id = <NUM_LIT:2> , title = '<STR_LIT>' ) , <EOL> dict ( id = <NUM_LIT:4> , user_id = <NUM_LIT:2> , title = '<STR_LIT>' ) , <EOL> dict ( id = <NUM_LIT:5> , user_id = <NUM_LIT:3> , title = '<STR_LIT>' ) , <EOL> dict ( id = <NUM_LIT:6> , user_id = <NUM_LIT:3> , title = '<STR_LIT>' ) , <EOL> ] ) <EOL> @ classmethod <EOL> def setup_mappers ( cls ) : <EOL> documents , Document , User , users = ( cls . tables . documents , <EOL> cls . classes . Document , <EOL> cls . classes . User , <EOL> cls . tables . users ) <EOL> mapper ( User , users ) <EOL> mapper ( Document , documents , properties = { <EOL> '<STR_LIT:user>' : relationship ( User , backref = '<STR_LIT>' ) <EOL> } ) <EOL> @ testing . requires . update_from <EOL> def test_update_from_joined_subq_test ( self ) : <EOL> Document = self . classes . Document <EOL> s = Session ( ) <EOL> subq = s . query ( func . max ( Document . title ) . label ( '<STR_LIT:title>' ) ) . group_by ( Document . user_id ) . subquery ( ) <EOL> s . query ( Document ) . filter ( Document . title == subq . c . title ) . update ( { '<STR_LIT>' : True } , synchronize_session = False ) <EOL> eq_ ( <EOL> set ( s . query ( Document . id , Document . flag ) ) , <EOL> set ( [ <EOL> ( <NUM_LIT:1> , True ) , ( <NUM_LIT:2> , None ) , <EOL> ( <NUM_LIT:3> , None ) , ( <NUM_LIT:4> , True ) , <EOL> ( <NUM_LIT:5> , True ) , ( <NUM_LIT:6> , None ) ] ) <EOL> ) <EOL> def test_no_eval_against_multi_table_criteria ( self ) : <EOL> User = self . classes . User <EOL> Document = self . classes . Document <EOL> s = Session ( ) <EOL> q = s . query ( User ) . filter ( User . id == Document . user_id ) <EOL> assert_raises_message ( <EOL> exc . InvalidRequestError , <EOL> "<STR_LIT>" , <EOL> q . update , <EOL> { "<STR_LIT:name>" : "<STR_LIT>" } <EOL> ) <EOL> @ testing . requires . update_where_target_in_subquery <EOL> def test_update_using_in ( self ) : <EOL> Document = self . classes . Document <EOL> s = Session ( ) <EOL> subq = s . query ( func . max ( Document . title ) . label ( '<STR_LIT:title>' ) ) . group_by ( Document . user_id ) . subquery ( ) <EOL> s . query ( Document ) . filter ( Document . title . in_ ( subq ) ) . update ( { '<STR_LIT>' : True } , synchronize_session = False ) <EOL> eq_ ( <EOL> set ( s . query ( Document . id , Document . flag ) ) , <EOL> set ( [ <EOL> ( <NUM_LIT:1> , True ) , ( <NUM_LIT:2> , None ) , <EOL> ( <NUM_LIT:3> , None ) , ( <NUM_LIT:4> , True ) , <EOL> ( <NUM_LIT:5> , True ) , ( <NUM_LIT:6> , None ) ] ) <EOL> ) <EOL> @ testing . requires . update_where_target_in_subquery <EOL> @ testing . requires . standalone_binds <EOL> def test_update_using_case ( self ) : <EOL> Document = self . classes . Document <EOL> s = Session ( ) <EOL> subq = s . query ( func . max ( Document . title ) . label ( '<STR_LIT:title>' ) ) . group_by ( Document . user_id ) . subquery ( ) <EOL> case_stmt = case ( [ ( Document . title . in_ ( subq ) , True ) ] , else_ = False ) <EOL> s . query ( Document ) . update ( <EOL> { '<STR_LIT>' : case_stmt } , synchronize_session = False ) <EOL> eq_ ( <EOL> set ( s . query ( Document . id , Document . flag ) ) , <EOL> set ( [ <EOL> ( <NUM_LIT:1> , True ) , ( <NUM_LIT:2> , False ) , <EOL> ( <NUM_LIT:3> , False ) , ( <NUM_LIT:4> , True ) , <EOL> ( <NUM_LIT:5> , True ) , ( <NUM_LIT:6> , False ) ] ) <EOL> ) <EOL> @ testing . only_on ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> def test_update_from_multitable_same_names ( self ) : <EOL> Document = self . classes . Document <EOL> User = self . classes . User <EOL> s = Session ( ) <EOL> s . query ( Document ) . filter ( User . id == Document . user_id ) . filter ( User . id == <NUM_LIT:2> ) . update ( { <EOL> Document . samename : '<STR_LIT>' , <EOL> User . samename : '<STR_LIT>' <EOL> } , synchronize_session = False ) <EOL> eq_ ( <EOL> s . query ( User . id , Document . samename , User . samename ) . <EOL> filter ( User . id == Document . user_id ) . <EOL> order_by ( User . id ) . all ( ) , <EOL> [ <EOL> ( <NUM_LIT:1> , None , None ) , <EOL> ( <NUM_LIT:1> , None , None ) , <EOL> ( <NUM_LIT:2> , '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( <NUM_LIT:2> , '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( <NUM_LIT:3> , None , None ) , <EOL> ( <NUM_LIT:3> , None , None ) , <EOL> ] <EOL> ) <EOL> class ExpressionUpdateTest ( fixtures . MappedTest ) : <EOL> @ classmethod <EOL> def define_tables ( cls , metadata ) : <EOL> data = Table ( '<STR_LIT:data>' , metadata , <EOL> Column ( '<STR_LIT:id>' , Integer , primary_key = True , <EOL> test_needs_autoincrement = True ) , <EOL> Column ( '<STR_LIT>' , Integer , nullable = False , default = <NUM_LIT:0> ) <EOL> ) <EOL> @ classmethod <EOL> def setup_classes ( cls ) : <EOL> class Data ( cls . Comparable ) : <EOL> pass <EOL> @ classmethod <EOL> def setup_mappers ( cls ) : <EOL> data = cls . tables . data <EOL> mapper ( cls . classes . Data , data , properties = { '<STR_LIT>' : data . c . counter } ) <EOL> @ testing . provide_metadata <EOL> def test_update_attr_names ( self ) : <EOL> Data = self . classes . Data <EOL> d1 = Data ( ) <EOL> sess = Session ( ) <EOL> sess . add ( d1 ) <EOL> sess . commit ( ) <EOL> eq_ ( d1 . cnt , <NUM_LIT:0> ) <EOL> sess . query ( Data ) . update ( { Data . cnt : Data . cnt + <NUM_LIT:1> } ) <EOL> sess . flush ( ) <EOL> eq_ ( d1 . cnt , <NUM_LIT:1> ) <EOL> sess . query ( Data ) . update ( { Data . cnt : Data . cnt + <NUM_LIT:1> } , '<STR_LIT>' ) <EOL> sess . flush ( ) <EOL> eq_ ( d1 . cnt , <NUM_LIT:2> ) <EOL> sess . close ( ) <EOL> def test_update_args ( self ) : <EOL> Data = self . classes . Data <EOL> session = testing . mock . Mock ( wraps = Session ( ) ) <EOL> update_args = { "<STR_LIT>" : <NUM_LIT:1> } <EOL> query . Query ( Data , session ) . update ( { Data . cnt : Data . cnt + <NUM_LIT:1> } , <EOL> update_args = update_args ) <EOL> eq_ ( session . execute . call_count , <NUM_LIT:1> ) <EOL> args , kwargs = session . execute . call_args <EOL> eq_ ( len ( args ) , <NUM_LIT:1> ) <EOL> update_stmt = args [ <NUM_LIT:0> ] <EOL> eq_ ( update_stmt . dialect_kwargs , update_args ) <EOL> class InheritTest ( fixtures . DeclarativeMappedTest ) : <EOL> run_inserts = '<STR_LIT>' <EOL> run_deletes = '<STR_LIT>' <EOL> __backend__ = True <EOL> @ classmethod <EOL> def setup_classes ( cls ) : <EOL> Base = cls . DeclarativeBasic <EOL> class Person ( Base ) : <EOL> __tablename__ = '<STR_LIT>' <EOL> id = Column ( <EOL> Integer , primary_key = True , test_needs_autoincrement = True ) <EOL> type = Column ( String ( <NUM_LIT:50> ) ) <EOL> name = Column ( String ( <NUM_LIT:50> ) ) <EOL> class Engineer ( Person ) : <EOL> __tablename__ = '<STR_LIT>' <EOL> id = Column ( Integer , ForeignKey ( '<STR_LIT>' ) , primary_key = True ) <EOL> engineer_name = Column ( String ( <NUM_LIT:50> ) ) <EOL> class Manager ( Person ) : <EOL> __tablename__ = '<STR_LIT>' <EOL> id = Column ( Integer , ForeignKey ( '<STR_LIT>' ) , primary_key = True ) <EOL> manager_name = Column ( String ( <NUM_LIT:50> ) ) <EOL> @ classmethod <EOL> def insert_data ( cls ) : <EOL> Engineer , Person , Manager = cls . classes . Engineer , cls . classes . Person , cls . classes . Manager <EOL> s = Session ( testing . db ) <EOL> s . add_all ( [ <EOL> Engineer ( name = '<STR_LIT>' , engineer_name = '<STR_LIT>' ) , <EOL> Manager ( name = '<STR_LIT>' , manager_name = '<STR_LIT>' ) , <EOL> Engineer ( name = '<STR_LIT>' , engineer_name = '<STR_LIT>' ) , <EOL> Person ( name = '<STR_LIT>' ) , <EOL> ] ) <EOL> s . commit ( ) <EOL> def test_illegal_metadata ( self ) : <EOL> person = self . classes . Person . __table__ <EOL> engineer = self . classes . Engineer . __table__ <EOL> sess = Session ( ) <EOL> assert_raises_message ( <EOL> exc . InvalidRequestError , <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" , <EOL> sess . query ( person . join ( engineer ) ) . update , { } <EOL> ) <EOL> def test_update_subtable_only ( self ) : <EOL> Engineer = self . classes . Engineer <EOL> s = Session ( testing . db ) <EOL> s . query ( Engineer ) . update ( { '<STR_LIT>' : '<STR_LIT>' } ) <EOL> eq_ ( <EOL> s . query ( Engineer . engineer_name ) . all ( ) , <EOL> [ ( '<STR_LIT>' , ) , ( '<STR_LIT>' , ) ] <EOL> ) <EOL> @ testing . requires . update_from <EOL> def test_update_from ( self ) : <EOL> Engineer = self . classes . Engineer <EOL> Person = self . classes . Person <EOL> s = Session ( testing . db ) <EOL> s . query ( Engineer ) . filter ( Engineer . id == Person . id ) . filter ( Person . name == '<STR_LIT>' ) . update ( { '<STR_LIT>' : '<STR_LIT>' } ) <EOL> eq_ ( <EOL> set ( s . query ( Person . name , Engineer . engineer_name ) ) , <EOL> set ( [ ( '<STR_LIT>' , '<STR_LIT>' , ) , ( '<STR_LIT>' , '<STR_LIT>' ) ] ) <EOL> ) <EOL> @ testing . only_on ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> def test_update_from_multitable ( self ) : <EOL> Engineer = self . classes . Engineer <EOL> Person = self . classes . Person <EOL> s = Session ( testing . db ) <EOL> s . query ( Engineer ) . filter ( Engineer . id == Person . id ) . filter ( Person . name == '<STR_LIT>' ) . update ( { Person . name : '<STR_LIT>' , <EOL> Engineer . engineer_name : '<STR_LIT>' } ) <EOL> eq_ ( <EOL> set ( s . query ( Person . name , Engineer . engineer_name ) ) , <EOL> set ( [ ( '<STR_LIT>' , '<STR_LIT>' , ) , ( '<STR_LIT>' , '<STR_LIT>' ) ] ) <EOL> ) </s>
