Test that post_update remembers to be involved in update operations as well, since it replaces the normal dependency processing completely [ticket:413]
(self)
| 1455 | pass |
| 1456 | |
| 1457 | def test_one(self): |
| 1458 | """ |
| 1459 | Test that post_update remembers to be involved in update operations as |
| 1460 | well, since it replaces the normal dependency processing completely |
| 1461 | [ticket:413] |
| 1462 | |
| 1463 | """ |
| 1464 | |
| 1465 | A, a_table = self.classes.A, self.tables.a_table |
| 1466 | |
| 1467 | self.mapper_registry.map_imperatively( |
| 1468 | A, |
| 1469 | a_table, |
| 1470 | properties={ |
| 1471 | "foo": relationship( |
| 1472 | A, remote_side=[a_table.c.id], post_update=True |
| 1473 | ) |
| 1474 | }, |
| 1475 | ) |
| 1476 | |
| 1477 | session = fixture_session() |
| 1478 | |
| 1479 | f1 = A(fui="f1") |
| 1480 | session.add(f1) |
| 1481 | session.flush() |
| 1482 | |
| 1483 | f2 = A(fui="f2", foo=f1) |
| 1484 | |
| 1485 | # at this point f1 is already inserted. but we need post_update |
| 1486 | # to fire off anyway |
| 1487 | session.add(f2) |
| 1488 | session.flush() |
| 1489 | session.expunge_all() |
| 1490 | |
| 1491 | f1 = session.get(A, f1.id) |
| 1492 | f2 = session.get(A, f2.id) |
| 1493 | assert f2.foo is f1 |
| 1494 | |
| 1495 | |
| 1496 | class SelfReferentialPostUpdateTest3(fixtures.MappedTest): |
nothing calls this directly
no test coverage detected