MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_expr_default_value

Method test_expr_default_value

test/orm/test_deferred.py:2265–2284  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2263 eq_(a1.all(), [A(my_expr=5), A(my_expr=15), A(my_expr=12)])
2264
2265 def test_expr_default_value(self):
2266 A = self.classes.A
2267 C = self.classes.C
2268 s = fixture_session()
2269
2270 a1 = s.query(A).order_by(A.id).filter(A.x > 1)
2271 eq_(a1.all(), [A(my_expr=None), A(my_expr=None), A(my_expr=None)])
2272
2273 c1 = s.query(C).order_by(C.id)
2274 eq_(c1.all(), [C(c_expr=1), C(c_expr=1)])
2275
2276 s.expunge_all()
2277
2278 c2 = (
2279 s.query(C)
2280 .options(with_expression(C.c_expr, C.x * 2))
2281 .filter(C.x > 1)
2282 .order_by(C.id)
2283 )
2284 eq_(c2.all(), [C(c_expr=4)])
2285
2286 def test_non_cacheable_expr(self):
2287 """test #10990"""

Callers

nothing calls this directly

Calls 11

fixture_sessionFunction · 0.90
eq_Function · 0.90
with_expressionFunction · 0.90
AClass · 0.70
CClass · 0.70
filterMethod · 0.45
order_byMethod · 0.45
queryMethod · 0.45
allMethod · 0.45
expunge_allMethod · 0.45
optionsMethod · 0.45

Tested by

no test coverage detected