MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_single

Method test_single

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

Source from the content-addressed store, hash-verified

66 self.data = data
67
68 def test_single(self):
69 C1, t1 = self.classes.C1, self.tables.t1
70
71 self.mapper_registry.map_imperatively(
72 C1,
73 t1,
74 properties={
75 "c1s": relationship(
76 C1, cascade="all", back_populates="parent"
77 ),
78 "parent": relationship(
79 C1,
80 primaryjoin=t1.c.parent_c1 == t1.c.c1,
81 remote_side=t1.c.c1,
82 lazy="select",
83 uselist=False,
84 back_populates="c1s",
85 ),
86 },
87 )
88 a = C1("head c1")
89 a.c1s.append(C1("another c1"))
90
91 sess = fixture_session()
92 sess.add(a)
93 sess.flush()
94 sess.delete(a)
95 sess.flush()
96
97 def test_many_to_one_only(self):
98 """

Callers

nothing calls this directly

Calls 8

relationshipFunction · 0.90
fixture_sessionFunction · 0.90
map_imperativelyMethod · 0.80
C1Class · 0.70
appendMethod · 0.45
addMethod · 0.45
flushMethod · 0.45
deleteMethod · 0.45

Tested by

no test coverage detected