test that a mapper can have two eager relationships to the same table, via two different association tables. aliases are required.
(self)
| 225 | assert p2 in p1.parent_places |
| 226 | |
| 227 | def test_joinedload_on_double(self): |
| 228 | """test that a mapper can have two eager relationships to the same |
| 229 | table, via two different association tables. aliases are required. |
| 230 | """ |
| 231 | |
| 232 | ( |
| 233 | place_input, |
| 234 | transition, |
| 235 | Transition, |
| 236 | PlaceThingy, |
| 237 | place, |
| 238 | place_thingy, |
| 239 | Place, |
| 240 | place_output, |
| 241 | ) = ( |
| 242 | self.tables.place_input, |
| 243 | self.tables.transition, |
| 244 | self.classes.Transition, |
| 245 | self.classes.PlaceThingy, |
| 246 | self.tables.place, |
| 247 | self.tables.place_thingy, |
| 248 | self.classes.Place, |
| 249 | self.tables.place_output, |
| 250 | ) |
| 251 | |
| 252 | self.mapper_registry.map_imperatively(PlaceThingy, place_thingy) |
| 253 | self.mapper_registry.map_imperatively( |
| 254 | Place, |
| 255 | place, |
| 256 | properties={"thingies": relationship(PlaceThingy, lazy="joined")}, |
| 257 | ) |
| 258 | |
| 259 | self.mapper_registry.map_imperatively( |
| 260 | Transition, |
| 261 | transition, |
| 262 | properties=dict( |
| 263 | inputs=relationship(Place, place_output, lazy="joined"), |
| 264 | outputs=relationship(Place, place_input, lazy="joined"), |
| 265 | ), |
| 266 | ) |
| 267 | |
| 268 | tran = Transition("transition1") |
| 269 | tran.inputs.append(Place("place1")) |
| 270 | tran.outputs.append(Place("place2")) |
| 271 | tran.outputs.append(Place("place3")) |
| 272 | sess = fixture_session() |
| 273 | sess.add(tran) |
| 274 | sess.commit() |
| 275 | |
| 276 | r = sess.query(Transition).all() |
| 277 | self.assert_unordered_result( |
| 278 | r, |
| 279 | Transition, |
| 280 | { |
| 281 | "name": "transition1", |
| 282 | "inputs": (Place, [{"name": "place1"}]), |
| 283 | "outputs": (Place, [{"name": "place2"}, {"name": "place3"}]), |
| 284 | }, |
nothing calls this directly
no test coverage detected