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

Method test_wp_queries

test/orm/test_cache_key.py:712–746  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

710 )
711
712 def test_wp_queries(self):
713 Person, Manager, Engineer, Boss = self.classes(
714 "Person", "Manager", "Engineer", "Boss"
715 )
716
717 def two():
718 wp = with_polymorphic(Person, [Manager, Engineer])
719
720 return fixture_session().query(wp)
721
722 def three():
723 wp = with_polymorphic(Person, [Manager, Engineer])
724
725 return fixture_session().query(wp).filter(wp.name == "asdfo")
726
727 def three_a():
728 wp = with_polymorphic(Person, [Manager, Engineer], flat=True)
729
730 return fixture_session().query(wp).filter(wp.name == "asdfo")
731
732 def five():
733 subq = (
734 select(Person)
735 .outerjoin(Manager)
736 .outerjoin(Engineer)
737 .subquery()
738 )
739 wp = with_polymorphic(Person, [Manager, Engineer], subq)
740
741 return fixture_session().query(wp).filter(wp.name == "asdfo")
742
743 self._run_cache_key_fixture(
744 lambda: stmt_20(two(), three(), three_a(), five()),
745 compare_values=True,
746 )
747
748 def test_wp_joins(self):
749 Company, Person, Manager, Engineer, Boss = self.classes(

Callers

nothing calls this directly

Calls 2

stmt_20Function · 0.85

Tested by

no test coverage detected