MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_cycle

Method test_cycle

test/orm/test_cycles.py:804–848  ·  view source on GitHub ↗

This test has a peculiar aspect in that it doesn't create as many dependent relationships as the other tests, and revealed a small glitch in the circular dependency sorting.

(self)

Source from the content-addressed store, hash-verified

802 pass
803
804 def test_cycle(self):
805 """
806 This test has a peculiar aspect in that it doesn't create as many
807 dependent relationships as the other tests, and revealed a small
808 glitch in the circular dependency sorting.
809
810 """
811
812 person, ball, Ball, Person = (
813 self.tables.person,
814 self.tables.ball,
815 self.classes.Ball,
816 self.classes.Person,
817 )
818
819 self.mapper_registry.map_imperatively(Ball, ball)
820 self.mapper_registry.map_imperatively(
821 Person,
822 person,
823 properties=dict(
824 balls=relationship(
825 Ball,
826 primaryjoin=ball.c.person_id == person.c.id,
827 remote_side=ball.c.person_id,
828 _legacy_inactive_history_style=(
829 self._legacy_inactive_history_style
830 ),
831 ),
832 favorite=relationship(
833 Ball,
834 primaryjoin=person.c.favorite_ball_id == ball.c.id,
835 remote_side=ball.c.id,
836 _legacy_inactive_history_style=(
837 self._legacy_inactive_history_style
838 ),
839 ),
840 ),
841 )
842
843 b = Ball()
844 p = Person()
845 p.balls.append(b)
846 sess = fixture_session()
847 sess.add(p)
848 sess.flush()
849
850 def test_post_update_m2o_no_cascade(self):
851 person, ball, Ball, Person = (

Callers

nothing calls this directly

Calls 8

relationshipFunction · 0.90
fixture_sessionFunction · 0.90
BallClass · 0.85
map_imperativelyMethod · 0.80
PersonClass · 0.70
appendMethod · 0.45
addMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected