MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_outerjoin_where_x2_t2

Method test_outerjoin_where_x2_t2

test/sql/test_query.py:1537–1562  ·  view source on GitHub ↗

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

(self)

Source from the content-addressed store, hash-verified

1535 self.assertRows(expr, [(10, 20, 30), (11, 21, None)])
1536
1537 def test_outerjoin_where_x2_t2(self):
1538 """Outer joins t1->t2,t3, where on t2."""
1539 t1, t2, t3 = self.tables("t1", "t2", "t3")
1540
1541 for criteria in (t2.c.t2_id == t3.c.t2_id, t3.c.t2_id == t2.c.t2_id):
1542 expr = (
1543 select(t1.c.t1_id, t2.c.t2_id, t3.c.t3_id)
1544 .where(t2.c.name == "t2 #20")
1545 .select_from(
1546 t1.outerjoin(t2, t1.c.t1_id == t2.c.t1_id).outerjoin(
1547 t3, criteria
1548 )
1549 )
1550 )
1551 self.assertRows(expr, [(10, 20, 30)])
1552
1553 expr = (
1554 select(t1.c.t1_id, t2.c.t2_id, t3.c.t3_id)
1555 .where(t2.c.t2_id < 29)
1556 .select_from(
1557 t1.outerjoin(t2, t1.c.t1_id == t2.c.t1_id).outerjoin(
1558 t3, criteria
1559 )
1560 )
1561 )
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."""

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