(self)
| 1693 | ) |
| 1694 | |
| 1695 | def test_c_only(self): |
| 1696 | A, B, C = self.classes("A", "B", "C") |
| 1697 | self._fixture(c_p=True) |
| 1698 | |
| 1699 | s = fixture_session() |
| 1700 | a1, b1, c1 = A(id=1), B(id=2), C(cid=1, id=3) |
| 1701 | s.add_all([a1, b1, c1]) |
| 1702 | s.commit() |
| 1703 | |
| 1704 | s.delete(a1) |
| 1705 | |
| 1706 | with self.sql_execution_asserter(testing.db) as asserter: |
| 1707 | s.flush() |
| 1708 | asserter.assert_( |
| 1709 | CompiledSQL( |
| 1710 | "SELECT a.id, a.type FROM a WHERE a.id = :pk_1", |
| 1711 | [{"pk_1": 1}], |
| 1712 | ), |
| 1713 | CompiledSQL("DELETE FROM a WHERE a.id = :id", [{"id": 1}]), |
| 1714 | ) |
| 1715 | |
| 1716 | b1.id |
| 1717 | s.delete(b1) |
| 1718 | with self.sql_execution_asserter(testing.db) as asserter: |
| 1719 | s.flush() |
| 1720 | asserter.assert_( |
| 1721 | CompiledSQL("DELETE FROM b WHERE b.id = :id", [{"id": 2}]), |
| 1722 | CompiledSQL("DELETE FROM a WHERE a.id = :id", [{"id": 2}]), |
| 1723 | ) |
| 1724 | |
| 1725 | # want to see if the 'C' table loads even though |
| 1726 | # a and b are loaded |
| 1727 | c1 = s.query(A).filter_by(id=3).first() |
| 1728 | s.delete(c1) |
| 1729 | with self.sql_execution_asserter(testing.db) as asserter: |
| 1730 | s.flush() |
| 1731 | asserter.assert_( |
| 1732 | CompiledSQL("DELETE FROM b WHERE b.id = :id", [{"id": 3}]), |
| 1733 | CompiledSQL("DELETE FROM a WHERE a.id = :id", [{"id": 3}]), |
| 1734 | ) |
| 1735 | |
| 1736 | def test_b_only(self): |
| 1737 | A, B, C = self.classes("A", "B", "C") |
nothing calls this directly
no test coverage detected