test that active history is enabled on a one-to-many/one that has use_get==True
(self)
| 1541 | return self._a_id |
| 1542 | |
| 1543 | def test_synonym_fk(self): |
| 1544 | """test that active history is enabled on a |
| 1545 | one-to-many/one that has use_get==True""" |
| 1546 | |
| 1547 | tableB, A, B, tableA = ( |
| 1548 | self.tables.tableB, |
| 1549 | self.classes.A, |
| 1550 | self.classes.B, |
| 1551 | self.tables.tableA, |
| 1552 | ) |
| 1553 | |
| 1554 | self.mapper_registry.map_imperatively( |
| 1555 | B, tableB, properties={"a_id": synonym("_a_id", map_column=True)} |
| 1556 | ) |
| 1557 | self.mapper_registry.map_imperatively( |
| 1558 | A, |
| 1559 | tableA, |
| 1560 | properties={ |
| 1561 | "b": relationship( |
| 1562 | B, |
| 1563 | primaryjoin=(tableA.c.id == foreign(B.a_id)), |
| 1564 | uselist=False, |
| 1565 | ) |
| 1566 | }, |
| 1567 | ) |
| 1568 | |
| 1569 | sess = fixture_session() |
| 1570 | |
| 1571 | b = B(id=0) |
| 1572 | a = A(id=0, b=b) |
| 1573 | sess.add(a) |
| 1574 | sess.add(b) |
| 1575 | sess.flush() |
| 1576 | sess.expunge_all() |
| 1577 | |
| 1578 | assert a.b == b |
| 1579 | assert a.id == b.a_id |
| 1580 | assert a.id == b._a_id |
| 1581 | |
| 1582 | |
| 1583 | class FKsAsPksTest(fixtures.MappedTest): |
nothing calls this directly
no test coverage detected