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

Method test_text

test/sql/test_external_traversal.py:791–806  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

789 )
790
791 def test_text(self):
792 clause = text("select * from table where foo=:bar").bindparams(
793 bindparam("bar")
794 )
795 c1 = str(clause)
796
797 class Vis(CloningVisitor):
798 def visit_textclause(self, text):
799 text.text = text.text + " SOME MODIFIER=:lala"
800 text._bindparams["lala"] = bindparam("lala")
801
802 clause2 = Vis().traverse(clause)
803 assert c1 == str(clause)
804 assert str(clause2) == c1 + " SOME MODIFIER=:lala"
805 assert list(clause._bindparams.keys()) == ["bar"]
806 assert set(clause2._bindparams.keys()) == {"bar", "lala"}
807
808 def test_select(self):
809 s2 = select(t1)

Callers

nothing calls this directly

Calls 6

textFunction · 0.90
bindparamFunction · 0.90
VisClass · 0.70
bindparamsMethod · 0.45
traverseMethod · 0.45
keysMethod · 0.45

Tested by

no test coverage detected