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

Method test_cycle

test/orm/test_cycles.py:593–631  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

591 pass
592
593 def test_cycle(self):
594 C2, C1, t2, t1 = (
595 self.classes.C2,
596 self.classes.C1,
597 self.tables.t2,
598 self.tables.t1,
599 )
600
601 self.mapper_registry.map_imperatively(
602 C2,
603 t2,
604 properties={
605 "c1s": relationship(
606 C1, primaryjoin=t2.c.c1 == t1.c.c2, uselist=True
607 )
608 },
609 )
610 self.mapper_registry.map_imperatively(
611 C1,
612 t1,
613 properties={
614 "c2s": relationship(
615 C2, primaryjoin=t1.c.c1 == t2.c.c2, uselist=True
616 )
617 },
618 )
619
620 a = C1()
621 b = C2()
622 c = C1()
623 d = C2()
624 e = C2()
625 f = C2()
626 a.c2s.append(b)
627 d.c1s.append(c)
628 b.c1s.append(c)
629 sess = fixture_session()
630 sess.add_all((a, b, c, d, e, f))
631 sess.flush()
632
633
634class BiDirectionalOneToManyTest2(fixtures.MappedTest):

Callers

nothing calls this directly

Calls 8

relationshipFunction · 0.90
fixture_sessionFunction · 0.90
map_imperativelyMethod · 0.80
C1Class · 0.70
C2Class · 0.70
appendMethod · 0.45
add_allMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected