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

Class CoreFixtures

test/sql/test_compare.py:174–1189  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

172
173
174class CoreFixtures:
175 # lambdas which return a tuple of ColumnElement objects.
176 # must return at least two objects that should compare differently.
177 # to test more varieties of "difference" additional objects can be added.
178 fixtures = [
179 lambda: (
180 column("q"),
181 column("x"),
182 column("q", Integer),
183 column("q", String),
184 ),
185 lambda: (~column("q", Boolean), ~column("p", Boolean)),
186 lambda: (
187 table_a.c.a.label("foo"),
188 table_a.c.a.label("bar"),
189 table_a.c.b.label("foo"),
190 ),
191 lambda: (
192 _label_reference(table_a.c.a.desc()),
193 _label_reference(table_a.c.a.asc()),
194 ),
195 lambda: (_textual_label_reference("a"), _textual_label_reference("b")),
196 lambda: (
197 text("select a, b from table").columns(a=Integer, b=String),
198 text("select a, b, c from table").columns(
199 a=Integer, b=String, c=Integer
200 ),
201 text("select a, b, c from table where foo=:bar").bindparams(
202 bindparam("bar", type_=Integer)
203 ),
204 text("select a, b, c from table where foo=:foo").bindparams(
205 bindparam("foo", type_=Integer)
206 ),
207 text("select a, b, c from table where foo=:bar").bindparams(
208 bindparam("bar", type_=String)
209 ),
210 ),
211 lambda: (
212 # test #11471
213 text("select * from table")
214 .columns(a=Integer())
215 .add_cte(table_b.select().cte()),
216 text("select * from table")
217 .columns(a=Integer())
218 .add_cte(table_b.select().where(table_b.c.a > 5).cte()),
219 ),
220 lambda: (
221 union(
222 select(table_a).where(table_a.c.a > 1),
223 select(table_a).where(table_a.c.a < 1),
224 ).add_cte(select(table_b).where(table_b.c.a > 1).cte("ttt")),
225 union(
226 select(table_a).where(table_a.c.a > 1),
227 select(table_a).where(table_a.c.a < 1),
228 ).add_cte(select(table_b).where(table_b.c.a < 1).cte("ttt")),
229 union(
230 select(table_a).where(table_a.c.a > 1),
231 select(table_a).where(table_a.c.a < 1),

Callers

nothing calls this directly

Calls 15

columnFunction · 0.90
_label_referenceClass · 0.90
textFunction · 0.90
bindparamFunction · 0.90
IntegerClass · 0.90
unionFunction · 0.90
selectFunction · 0.90
literalFunction · 0.90
UnaryExpressionClass · 0.90
ARRAYClass · 0.90
tableFunction · 0.90

Tested by

no test coverage detected