(self)
| 131 | assert c2.parent_c1 == c1.c1 |
| 132 | |
| 133 | def test_cycle(self): |
| 134 | C2, C1, t2, t1 = ( |
| 135 | self.classes.C2, |
| 136 | self.classes.C1, |
| 137 | self.tables.t2, |
| 138 | self.tables.t1, |
| 139 | ) |
| 140 | |
| 141 | self.mapper_registry.map_imperatively( |
| 142 | C1, |
| 143 | t1, |
| 144 | properties={ |
| 145 | "c1s": relationship(C1, cascade="all"), |
| 146 | "c2s": relationship( |
| 147 | self.mapper_registry.map_imperatively(C2, t2), |
| 148 | cascade="all, delete-orphan", |
| 149 | ), |
| 150 | }, |
| 151 | ) |
| 152 | |
| 153 | a = C1("head c1") |
| 154 | a.c1s.append(C1("child1")) |
| 155 | a.c1s.append(C1("child2")) |
| 156 | a.c1s[0].c1s.append(C1("subchild1")) |
| 157 | a.c1s[0].c1s.append(C1("subchild2")) |
| 158 | a.c1s[1].c2s.append(C2("child2 data1")) |
| 159 | a.c1s[1].c2s.append(C2("child2 data2")) |
| 160 | sess = fixture_session() |
| 161 | sess.add(a) |
| 162 | sess.flush() |
| 163 | |
| 164 | sess.delete(a) |
| 165 | sess.flush() |
| 166 | |
| 167 | def test_setnull_ondelete(self): |
| 168 | C1, t1 = self.classes.C1, self.tables.t1 |
nothing calls this directly
no test coverage detected