MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_b_only

Method test_b_only

test/orm/inheritance/test_basic.py:1736–1771  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1734 )
1735
1736 def test_b_only(self):
1737 A, B, C = self.classes("A", "B", "C")
1738 self._fixture(b_p=True)
1739
1740 s = fixture_session()
1741 a1, b1, c1 = A(id=1), B(id=2), C(cid=1, id=3)
1742 s.add_all([a1, b1, c1])
1743 s.commit()
1744
1745 s.delete(a1)
1746
1747 with self.sql_execution_asserter(testing.db) as asserter:
1748 s.flush()
1749 asserter.assert_(
1750 CompiledSQL(
1751 "SELECT a.id, a.type FROM a WHERE a.id = :pk_1",
1752 [{"pk_1": 1}],
1753 ),
1754 CompiledSQL("DELETE FROM a WHERE a.id = :id", [{"id": 1}]),
1755 )
1756
1757 b1.id
1758 s.delete(b1)
1759 with self.sql_execution_asserter(testing.db) as asserter:
1760 s.flush()
1761 asserter.assert_(
1762 CompiledSQL("DELETE FROM a WHERE a.id = :id", [{"id": 2}])
1763 )
1764
1765 c1.id
1766 s.delete(c1)
1767 with self.sql_execution_asserter(testing.db) as asserter:
1768 s.flush()
1769 asserter.assert_(
1770 CompiledSQL("DELETE FROM a WHERE a.id = :id", [{"id": 3}])
1771 )
1772
1773 def test_a_only(self):
1774 A, B, C = self.classes("A", "B", "C")

Callers

nothing calls this directly

Calls 12

_fixtureMethod · 0.95
fixture_sessionFunction · 0.90
CompiledSQLClass · 0.90
AClass · 0.70
BClass · 0.70
CClass · 0.70
add_allMethod · 0.45
commitMethod · 0.45
deleteMethod · 0.45
flushMethod · 0.45
assert_Method · 0.45

Tested by

no test coverage detected