test ticket 1306
(self)
| 4137 | "The `objects` parameter of `Session.flush` is deprecated" |
| 4138 | ) |
| 4139 | def test_circular_sort(self): |
| 4140 | """test ticket 1306""" |
| 4141 | |
| 4142 | base, inh_child, parent = ( |
| 4143 | self.tables.base, |
| 4144 | self.tables.inh_child, |
| 4145 | self.tables.parent, |
| 4146 | ) |
| 4147 | |
| 4148 | class Base(ComparableEntity): |
| 4149 | pass |
| 4150 | |
| 4151 | class Parent(Base): |
| 4152 | pass |
| 4153 | |
| 4154 | class Child(Base): |
| 4155 | pass |
| 4156 | |
| 4157 | self.mapper_registry.map_imperatively(Base, base) |
| 4158 | |
| 4159 | self.mapper_registry.map_imperatively( |
| 4160 | Child, |
| 4161 | inh_child, |
| 4162 | inherits=Base, |
| 4163 | properties={ |
| 4164 | "parent": relationship( |
| 4165 | Parent, |
| 4166 | backref="children", |
| 4167 | primaryjoin=inh_child.c.parent_id == parent.c.id, |
| 4168 | ) |
| 4169 | }, |
| 4170 | ) |
| 4171 | |
| 4172 | self.mapper_registry.map_imperatively(Parent, parent, inherits=Base) |
| 4173 | |
| 4174 | sess = fixture_session() |
| 4175 | p1 = Parent() |
| 4176 | |
| 4177 | c1, c2, c3 = Child(), Child(), Child() |
| 4178 | p1.children = [c1, c2, c3] |
| 4179 | sess.add(p1) |
| 4180 | |
| 4181 | sess.flush([c1]) |
| 4182 | assert p1 in sess.new |
| 4183 | assert c1 not in sess.new |
| 4184 | assert c2 in sess.new |
| 4185 | |
| 4186 | |
| 4187 | class SubclassCascadeTest(fixtures.DeclarativeMappedTest): |
nothing calls this directly
no test coverage detected