MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / _do_move_test

Method _do_move_test

test/orm/test_cascade.py:3842–3864  ·  view source on GitHub ↗
(self, delete_old)

Source from the content-addressed store, hash-verified

3840 pass
3841
3842 def _do_move_test(self, delete_old):
3843 Parent, Child = self.classes.Parent, self.classes.Child
3844
3845 with fixture_session(autoflush=False) as sess:
3846 p1, p2, c1 = Parent(), Parent(), Child()
3847 if Parent.child.property.uselist:
3848 p1.child.append(c1)
3849 else:
3850 p1.child = c1
3851 sess.add_all([p1, c1])
3852 sess.flush()
3853
3854 if delete_old:
3855 sess.delete(p1)
3856
3857 if Parent.child.property.uselist:
3858 p2.child.append(c1)
3859 else:
3860 p2.child = c1
3861 sess.add(p2)
3862
3863 sess.flush()
3864 eq_(sess.query(Child).filter(Child.parent_id == p2.id).all(), [c1])
3865
3866 def test_o2o_delete_old(self):
3867 Child, Parent, parent, child = (

Calls 12

fixture_sessionFunction · 0.90
eq_Function · 0.90
ParentClass · 0.70
ChildClass · 0.70
appendMethod · 0.45
add_allMethod · 0.45
flushMethod · 0.45
deleteMethod · 0.45
addMethod · 0.45
allMethod · 0.45
filterMethod · 0.45
queryMethod · 0.45

Tested by

no test coverage detected