MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / test_wp_queries

Method test_wp_queries

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

Source from the content-addressed store, hash-verified

2509 )
2510
2511 def test_wp_queries(self):
2512 Person, Manager, Engineer, Boss = self.classes(
2513 "Person", "Manager", "Engineer", "Boss"
2514 )
2515
2516 def two():
2517 wp = with_polymorphic(Person, [Manager, Engineer])
2518
2519 return fixture_session().query(wp)
2520
2521 def three():
2522 wp = with_polymorphic(Person, [Manager, Engineer])
2523
2524 return fixture_session().query(wp).filter(wp.name == "asdfo")
2525
2526 def three_a():
2527 wp = with_polymorphic(Person, [Manager, Engineer], flat=True)
2528
2529 return fixture_session().query(wp).filter(wp.name == "asdfo")
2530
2531 def five():
2532 subq = (
2533 select(Person)
2534 .outerjoin(Manager)
2535 .outerjoin(Engineer)
2536 .subquery()
2537 )
2538 wp = with_polymorphic(Person, [Manager, Engineer], subq)
2539
2540 return fixture_session().query(wp).filter(wp.name == "asdfo")
2541
2542 self._run_cache_key_fixture(
2543 lambda: self._stmt_20(two(), three(), three_a(), five()),
2544 compare_values=True,
2545 )
2546
2547
2548class ParentTest(QueryTest, AssertsCompiledSQL):

Callers

nothing calls this directly

Calls 2

_stmt_20Method · 0.95

Tested by

no test coverage detected