test that active history is enabled on a one-to-many/one that has use_get==True
(self)
| 1611 | pass |
| 1612 | |
| 1613 | def test_onetoone_switch(self): |
| 1614 | """test that active history is enabled on a |
| 1615 | one-to-many/one that has use_get==True""" |
| 1616 | |
| 1617 | tableB, A, B, tableA = ( |
| 1618 | self.tables.tableB, |
| 1619 | self.classes.A, |
| 1620 | self.classes.B, |
| 1621 | self.tables.tableA, |
| 1622 | ) |
| 1623 | |
| 1624 | self.mapper_registry.map_imperatively( |
| 1625 | A, |
| 1626 | tableA, |
| 1627 | properties={ |
| 1628 | "b": relationship( |
| 1629 | B, cascade="all,delete-orphan", uselist=False |
| 1630 | ) |
| 1631 | }, |
| 1632 | ) |
| 1633 | self.mapper_registry.map_imperatively(B, tableB) |
| 1634 | |
| 1635 | configure_mappers() |
| 1636 | assert A.b.property.strategy.use_get |
| 1637 | |
| 1638 | with fixture_session() as sess: |
| 1639 | a1 = A() |
| 1640 | sess.add(a1) |
| 1641 | sess.commit() |
| 1642 | |
| 1643 | with fixture_session() as sess: |
| 1644 | a1 = sess.query(A).first() |
| 1645 | a1.b = B() |
| 1646 | sess.commit() |
| 1647 | |
| 1648 | def test_no_delete_PK_AtoB(self): |
| 1649 | """A can't be deleted without B because B would have no PK value.""" |
nothing calls this directly
no test coverage detected