MCPcopy
hub / github.com/psycopg/psycopg / test_binary_cursor_execute

Function test_binary_cursor_execute

tests/test_cursor_server.py:107–116  ·  view source on GitHub ↗
(conn)

Source from the content-addressed store, hash-verified

105
106
107def test_binary_cursor_execute(conn):
108 cur = conn.cursor("foo", binary=True)
109 cur.execute("select generate_series(1, 2)::int4")
110 assert cur.fetchone() == (1,)
111 assert cur.pgresult.fformat(0) == 1
112 assert cur.pgresult.get_value(0, 0) == b"\x00\x00\x00\x01"
113 assert cur.fetchone() == (2,)
114 assert cur.pgresult.fformat(0) == 1
115 assert cur.pgresult.get_value(0, 0) == b"\x00\x00\x00\x02"
116 cur.close()
117
118
119def test_execute_binary(conn):

Callers

nothing calls this directly

Calls 6

cursorMethod · 0.45
executeMethod · 0.45
fetchoneMethod · 0.45
fformatMethod · 0.45
get_valueMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected