MCPcopy Index your code
hub / github.com/zzzeek/sqlalchemy / test_join_condition_two

Method test_join_condition_two

test/sql/test_selectable.py:2128–2175  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2126 )
2127
2128 def test_join_condition_two(self):
2129 m = MetaData()
2130 t1 = Table("t1", m, Column("id", Integer))
2131 t2 = Table(
2132 "t2", m, Column("id", Integer), Column("t1id", ForeignKey("t1.id"))
2133 )
2134 t3 = Table(
2135 "t3",
2136 m,
2137 Column("id", Integer),
2138 Column("t1id", ForeignKey("t1.id")),
2139 Column("t2id", ForeignKey("t2.id")),
2140 )
2141 t4 = Table(
2142 "t4", m, Column("id", Integer), Column("t2id", ForeignKey("t2.id"))
2143 )
2144 t5 = Table(
2145 "t5",
2146 m,
2147 Column("t1id1", ForeignKey("t1.id")),
2148 Column("t1id2", ForeignKey("t1.id")),
2149 )
2150
2151 t1t2 = t1.join(t2)
2152 t2t3 = t2.join(t3)
2153
2154 # these are ambiguous, or have no joins
2155 for left, right, a_subset in [
2156 (t1t2, t3, None),
2157 (t2t3, t1, None),
2158 (t1, t4, None),
2159 (t1t2, t2t3, None),
2160 (t5, t1, None),
2161 (
2162 t5.select()
2163 .set_label_style(LABEL_STYLE_TABLENAME_PLUS_COL)
2164 .subquery(),
2165 t1,
2166 None,
2167 ),
2168 ]:
2169 assert_raises(
2170 exc.ArgumentError,
2171 sql_util.join_condition,
2172 left,
2173 right,
2174 a_subset=a_subset,
2175 )
2176
2177 def test_join_condition_three(self):
2178 m = MetaData()

Callers

nothing calls this directly

Calls 9

MetaDataClass · 0.90
TableClass · 0.90
ColumnClass · 0.90
ForeignKeyClass · 0.90
assert_raisesFunction · 0.90
joinMethod · 0.45
subqueryMethod · 0.45
set_label_styleMethod · 0.45
selectMethod · 0.45

Tested by

no test coverage detected