No 'blank the PK' error when the child is to be deleted as part of a cascade
(self, cascade)
| 1747 | "save-update, delete, delete-orphan", |
| 1748 | ) |
| 1749 | def test_delete_cascade_BtoA(self, cascade): |
| 1750 | """No 'blank the PK' error when the child is to |
| 1751 | be deleted as part of a cascade""" |
| 1752 | |
| 1753 | tableB, A, B, tableA = ( |
| 1754 | self.tables.tableB, |
| 1755 | self.classes.A, |
| 1756 | self.classes.B, |
| 1757 | self.tables.tableA, |
| 1758 | ) |
| 1759 | |
| 1760 | self.mapper_registry.map_imperatively( |
| 1761 | B, |
| 1762 | tableB, |
| 1763 | properties={ |
| 1764 | "a": relationship(A, cascade=cascade, single_parent=True) |
| 1765 | }, |
| 1766 | ) |
| 1767 | self.mapper_registry.map_imperatively(A, tableA) |
| 1768 | |
| 1769 | b1 = B() |
| 1770 | a1 = A() |
| 1771 | b1.a = a1 |
| 1772 | with fixture_session() as sess: |
| 1773 | sess.add(b1) |
| 1774 | sess.flush() |
| 1775 | sess.delete(b1) |
| 1776 | sess.flush() |
| 1777 | assert a1 not in sess |
| 1778 | assert b1 not in sess |
| 1779 | |
| 1780 | @testing.combinations( |
| 1781 | "save-update, delete", |
nothing calls this directly
no test coverage detected