MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_text_in_select_nonfrom

Method test_text_in_select_nonfrom

test/sql/test_text.py:492–513  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

490 )
491
492 def test_text_in_select_nonfrom(self):
493 generate_series = text(
494 "generate_series(:x, :y, :z) as s(a)"
495 ).bindparams(x=None, y=None, z=None)
496
497 s = select(
498 (func.current_date() + literal_column("s.a")).label("dates")
499 ).select_from(generate_series)
500
501 self.assert_compile(
502 s,
503 "SELECT CURRENT_DATE + s.a AS dates FROM "
504 "generate_series(:x, :y, :z) as s(a)",
505 checkparams={"y": None, "x": None, "z": None},
506 )
507
508 self.assert_compile(
509 s.params(x=5, y=6, z=7),
510 "SELECT CURRENT_DATE + s.a AS dates FROM "
511 "generate_series(:x, :y, :z) as s(a)",
512 checkparams={"y": 6, "x": 5, "z": 7},
513 )
514
515 def test_escaping_percent_signs(self):
516 stmt = text("select '%' where foo like '%bar%'")

Callers

nothing calls this directly

Calls 9

textFunction · 0.90
selectFunction · 0.90
literal_columnFunction · 0.90
current_dateMethod · 0.80
assert_compileMethod · 0.80
bindparamsMethod · 0.45
select_fromMethod · 0.45
labelMethod · 0.45
paramsMethod · 0.45

Tested by

no test coverage detected