MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_wp_queries

Method test_wp_queries

test/orm/test_deprecations.py:1652–1686  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1650 )
1651
1652 def test_wp_queries(self):
1653 Person, Manager, Engineer, Boss = self.classes(
1654 "Person", "Manager", "Engineer", "Boss"
1655 )
1656
1657 def two():
1658 wp = with_polymorphic(Person, [Manager, Engineer])
1659
1660 return fixture_session().query(wp)
1661
1662 def three():
1663 wp = with_polymorphic(Person, [Manager, Engineer])
1664
1665 return fixture_session().query(wp).filter(wp.name == "asdfo")
1666
1667 def three_a():
1668 wp = with_polymorphic(Person, [Manager, Engineer], flat=True)
1669
1670 return fixture_session().query(wp).filter(wp.name == "asdfo")
1671
1672 def five():
1673 subq = (
1674 select(Person)
1675 .outerjoin(Manager)
1676 .outerjoin(Engineer)
1677 .subquery()
1678 )
1679 wp = with_polymorphic(Person, [Manager, Engineer], subq)
1680
1681 return fixture_session().query(wp).filter(wp.name == "asdfo")
1682
1683 self._run_cache_key_fixture(
1684 lambda: self._stmt_20(two(), three(), three_a(), five()),
1685 compare_values=True,
1686 )
1687
1688
1689class ParentTest(QueryTest, AssertsCompiledSQL):

Callers

nothing calls this directly

Calls 2

_stmt_20Method · 0.95

Tested by

no test coverage detected