MCPcopy
hub / github.com/psycopg/psycopg / test_must_be_adaptable

Method test_must_be_adaptable

tests/test_sql.py:159–165  ·  view source on GitHub ↗
(self, conn)

Source from the content-addressed store, hash-verified

157 sql.SQL("select {a:<};").format(a=10)
158
159 def test_must_be_adaptable(self, conn):
160 class Foo:
161 pass
162
163 s = sql.SQL("select {0};").format(sql.Literal(Foo()))
164 with pytest.raises(ProgrammingError):
165 s.as_string(conn)
166
167 def test_auto_literal(self, conn):
168 s = sql.SQL("select {}, {}, {}").format("he'lo", 10, dt.date(2020, 1, 1))

Callers

nothing calls this directly

Calls 3

formatMethod · 0.80
FooClass · 0.70
as_stringMethod · 0.45

Tested by

no test coverage detected