MCPcopy
hub / github.com/psycopg/psycopg / test_connect_context_adapters

Function test_connect_context_adapters

tests/test_connection.py:861–872  ·  view source on GitHub ↗
(conn_cls, dsn)

Source from the content-addressed store, hash-verified

859
860
861def test_connect_context_adapters(conn_cls, dsn):
862 ctx = psycopg.adapt.AdaptersMap(psycopg.adapters)
863 ctx.register_dumper(str, make_bin_dumper("b"))
864 ctx.register_dumper(str, make_dumper("t"))
865
866 conn = conn_cls.connect(dsn, context=ctx)
867
868 cur = conn.execute("select %s", ["hello"])
869 assert cur.fetchone()[0] == "hellot"
870 cur = conn.execute("select %b", ["hello"])
871 assert cur.fetchone()[0] == "hellob"
872 conn.close()
873
874
875def test_connect_context_copy(conn_cls, dsn, conn):

Callers

nothing calls this directly

Calls 7

register_dumperMethod · 0.95
make_bin_dumperFunction · 0.85
make_dumperFunction · 0.85
connectMethod · 0.45
executeMethod · 0.45
fetchoneMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…