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

Function test_connect_context_adapters

tests/test_connection_async.py:878–889  ·  view source on GitHub ↗
(aconn_cls, dsn)

Source from the content-addressed store, hash-verified

876
877
878async def test_connect_context_adapters(aconn_cls, dsn):
879 ctx = psycopg.adapt.AdaptersMap(psycopg.adapters)
880 ctx.register_dumper(str, make_bin_dumper("b"))
881 ctx.register_dumper(str, make_dumper("t"))
882
883 conn = await aconn_cls.connect(dsn, context=ctx)
884
885 cur = await conn.execute("select %s", ["hello"])
886 assert (await cur.fetchone())[0] == "hellot"
887 cur = await conn.execute("select %b", ["hello"])
888 assert (await cur.fetchone())[0] == "hellob"
889 await conn.close()
890
891
892async def test_connect_context_copy(aconn_cls, dsn, aconn):

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…