MCPcopy
hub / github.com/psycopg/psycopg / test_dump_global_ctx

Function test_dump_global_ctx

tests/test_adapt.py:77–86  ·  view source on GitHub ↗
(conn_cls, dsn, global_adapters, pgconn)

Source from the content-addressed store, hash-verified

75
76@pytest.mark.crdb("skip", reason="global adapters don't affect crdb")
77def test_dump_global_ctx(conn_cls, dsn, global_adapters, pgconn):
78 psycopg.adapters.register_dumper(MyStr, make_bin_dumper("gb"))
79 psycopg.adapters.register_dumper(MyStr, make_dumper("gt"))
80 with conn_cls.connect(dsn) as conn:
81 cur = conn.execute("select %s", [MyStr("hello")])
82 assert cur.fetchone() == ("hellogt",)
83 cur = conn.execute("select %b", [MyStr("hello")])
84 assert cur.fetchone() == ("hellogb",)
85 cur = conn.execute("select %t", [MyStr("hello")])
86 assert cur.fetchone() == ("hellogt",)
87
88
89def test_dump_connection_ctx(conn):

Callers

nothing calls this directly

Calls 7

make_bin_dumperFunction · 0.85
make_dumperFunction · 0.85
MyStrClass · 0.85
register_dumperMethod · 0.80
connectMethod · 0.45
executeMethod · 0.45
fetchoneMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…