MCPcopy Create free account
hub / github.com/zzzeek/sqlalchemy / test_m2o_event

Method test_m2o_event

test/orm/test_backref_mutations.py:667–684  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

665 )
666
667 def test_m2o_event(self):
668 User, Address = self.classes.User, self.classes.Address
669
670 sess = fixture_session(future=True)
671 a1 = Address(email_address="address1")
672 u1 = User(name="jack", address=a1)
673
674 sess.add(u1)
675 sess.commit()
676 sess.expunge(u1)
677
678 u2 = User(name="ed")
679 # the _SingleParent extension sets the backref get to "active" !
680 # u1 gets loaded and deleted
681 sess.add(u2)
682 u2.address = a1
683 sess.commit()
684 assert sess.query(User).count() == 1
685
686
687class M2MCollectionMoveTest(_fixtures.FixtureTest):

Callers

nothing calls this directly

Calls 8

fixture_sessionFunction · 0.90
AddressClass · 0.70
UserClass · 0.70
addMethod · 0.45
commitMethod · 0.45
expungeMethod · 0.45
countMethod · 0.45
queryMethod · 0.45

Tested by

no test coverage detected