MCPcopy
hub / github.com/psycopg/psycopg / test_binary_cursor_text_override

Function test_binary_cursor_text_override

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

Source from the content-addressed store, hash-verified

134
135
136def test_binary_cursor_text_override(conn):
137 cur = conn.cursor("foo", binary=True)
138 cur.execute("select generate_series(1, 2)", binary=False)
139 assert cur.fetchone() == (1,)
140 assert cur.pgresult.fformat(0) == 0
141 assert cur.pgresult.get_value(0, 0) == b"1"
142 assert cur.fetchone() == (2,)
143 assert cur.pgresult.fformat(0) == 0
144 assert cur.pgresult.get_value(0, 0) == b"2"
145
146 cur.execute("select generate_series(1, 2)::int4")
147 assert cur.fetchone() == (1,)
148 assert cur.pgresult.fformat(0) == 1
149 assert cur.pgresult.get_value(0, 0) == b"\x00\x00\x00\x01"
150 cur.close()
151
152
153def test_close(conn, recwarn):

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