MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_outerjoin_where_x2_t3

Method test_outerjoin_where_x2_t3

test/sql/test_query.py:1564–1589  ·  view source on GitHub ↗

Outer joins t1->t2,t3, where on t3.

(self)

Source from the content-addressed store, hash-verified

1562 self.assertRows(expr, [(10, 20, 30), (11, 21, None)])
1563
1564 def test_outerjoin_where_x2_t3(self):
1565 """Outer joins t1->t2,t3, where on t3."""
1566 t1, t2, t3 = self.tables("t1", "t2", "t3")
1567
1568 for criteria in (t2.c.t2_id == t3.c.t2_id, t3.c.t2_id == t2.c.t2_id):
1569 expr = (
1570 select(t1.c.t1_id, t2.c.t2_id, t3.c.t3_id)
1571 .where(t3.c.name == "t3 #30")
1572 .select_from(
1573 t1.outerjoin(t2, t1.c.t1_id == t2.c.t1_id).outerjoin(
1574 t3, criteria
1575 )
1576 )
1577 )
1578 self.assertRows(expr, [(10, 20, 30)])
1579
1580 expr = (
1581 select(t1.c.t1_id, t2.c.t2_id, t3.c.t3_id)
1582 .where(t3.c.t3_id < 39)
1583 .select_from(
1584 t1.outerjoin(t2, t1.c.t1_id == t2.c.t1_id).outerjoin(
1585 t3, criteria
1586 )
1587 )
1588 )
1589 self.assertRows(expr, [(10, 20, 30)])
1590
1591 def test_outerjoin_where_x2_t1t3(self):
1592 """Outer joins t1->t2,t3, where on t1 and t3."""

Callers

nothing calls this directly

Calls 5

assertRowsMethod · 0.95
selectFunction · 0.90
select_fromMethod · 0.45
whereMethod · 0.45
outerjoinMethod · 0.45

Tested by

no test coverage detected