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

Method test_clauses

test/orm/test_query.py:2021–2036  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2019 )
2020
2021 def test_clauses(self):
2022 User, Address = self.classes.User, self.classes.Address
2023
2024 for expr, compare in (
2025 (func.max(User.id), "max(users.id)"),
2026 (User.id.desc(), "users.id DESC"),
2027 (
2028 between(5, User.id, Address.id),
2029 ":param_1 BETWEEN users.id AND addresses.id",
2030 ),
2031 # this one would require adding compile() to
2032 # InstrumentedScalarAttribute. do we want this ?
2033 # (User.id, "users.id")
2034 ):
2035 c = expr.compile(dialect=default.DefaultDialect())
2036 assert str(c) == compare, "%s != %s" % (str(c), compare)
2037
2038
2039class ExpressionTest(QueryTest, AssertsCompiledSQL):

Callers

nothing calls this directly

Calls 4

betweenFunction · 0.90
maxMethod · 0.80
descMethod · 0.45
compileMethod · 0.45

Tested by

no test coverage detected