(self)
| 356 | @testing.requires.updateable_autoincrement_pks |
| 357 | @testing.requires.sane_multi_rowcount |
| 358 | def test_stale_conditions(self): |
| 359 | Place, Transition, place_input, place, transition = ( |
| 360 | self.classes.Place, |
| 361 | self.classes.Transition, |
| 362 | self.tables.place_input, |
| 363 | self.tables.place, |
| 364 | self.tables.transition, |
| 365 | ) |
| 366 | |
| 367 | self.mapper_registry.map_imperatively( |
| 368 | Place, |
| 369 | place, |
| 370 | properties={ |
| 371 | "transitions": relationship( |
| 372 | Transition, secondary=place_input, passive_updates=False |
| 373 | ) |
| 374 | }, |
| 375 | ) |
| 376 | self.mapper_registry.map_imperatively(Transition, transition) |
| 377 | |
| 378 | p1 = Place("place1") |
| 379 | t1 = Transition("t1") |
| 380 | p1.transitions.append(t1) |
| 381 | sess = fixture_session() |
| 382 | sess.add_all([p1, t1]) |
| 383 | sess.commit() |
| 384 | |
| 385 | p1.place_id |
| 386 | p1.transitions |
| 387 | |
| 388 | sess.execute(place_input.delete()) |
| 389 | p1.place_id = 7 |
| 390 | |
| 391 | assert_raises_message( |
| 392 | orm_exc.StaleDataError, |
| 393 | r"UPDATE statement on table 'place_input' expected to " |
| 394 | r"update 1 row\(s\); Only 0 were matched.", |
| 395 | sess.commit, |
| 396 | ) |
| 397 | sess.rollback() |
| 398 | |
| 399 | p1.place_id |
| 400 | p1.transitions |
| 401 | sess.execute(place_input.delete()) |
| 402 | p1.transitions.remove(t1) |
| 403 | assert_raises_message( |
| 404 | orm_exc.StaleDataError, |
| 405 | r"DELETE statement on table 'place_input' expected to " |
| 406 | r"delete 1 row\(s\); Only 0 were matched.", |
| 407 | sess.commit, |
| 408 | ) |
| 409 | |
| 410 | |
| 411 | class AssortedPersistenceTests(fixtures.MappedTest): |
nothing calls this directly
no test coverage detected