(self)
| 1771 | ) |
| 1772 | |
| 1773 | def test_a_only(self): |
| 1774 | A, B, C = self.classes("A", "B", "C") |
| 1775 | self._fixture(a_p=True) |
| 1776 | |
| 1777 | s = fixture_session() |
| 1778 | a1, b1, c1 = A(id=1), B(id=2), C(cid=1, id=3) |
| 1779 | s.add_all([a1, b1, c1]) |
| 1780 | s.commit() |
| 1781 | |
| 1782 | s.delete(a1) |
| 1783 | |
| 1784 | with self.sql_execution_asserter(testing.db) as asserter: |
| 1785 | s.flush() |
| 1786 | asserter.assert_( |
| 1787 | CompiledSQL( |
| 1788 | "SELECT a.id, a.type FROM a WHERE a.id = :pk_1", |
| 1789 | [{"pk_1": 1}], |
| 1790 | ), |
| 1791 | CompiledSQL("DELETE FROM a WHERE a.id = :id", [{"id": 1}]), |
| 1792 | ) |
| 1793 | |
| 1794 | b1.id |
| 1795 | s.delete(b1) |
| 1796 | with self.sql_execution_asserter(testing.db) as asserter: |
| 1797 | s.flush() |
| 1798 | asserter.assert_( |
| 1799 | CompiledSQL("DELETE FROM a WHERE a.id = :id", [{"id": 2}]) |
| 1800 | ) |
| 1801 | |
| 1802 | # want to see if the 'C' table loads even though |
| 1803 | # a and b are loaded |
| 1804 | c1 = s.query(A).filter_by(id=3).first() |
| 1805 | s.delete(c1) |
| 1806 | with self.sql_execution_asserter(testing.db) as asserter: |
| 1807 | s.flush() |
| 1808 | asserter.assert_( |
| 1809 | CompiledSQL("DELETE FROM a WHERE a.id = :id", [{"id": 3}]) |
| 1810 | ) |
| 1811 | |
| 1812 | |
| 1813 | class OptimizedGetOnDeferredTest(fixtures.MappedTest): |
nothing calls this directly
no test coverage detected