MCPcopy
hub / github.com/psycopg/psycopg / test_copy_in_buffers

Function test_copy_in_buffers

tests/test_copy.py:220–228  ·  view source on GitHub ↗
(conn, format, buffer)

Source from the content-addressed store, hash-verified

218 [(pq.Format.TEXT, "sample_text"), (pq.Format.BINARY, "sample_binary")],
219)
220def test_copy_in_buffers(conn, format, buffer):
221 cur = conn.cursor()
222 ensure_table(cur, sample_tabledef)
223 with cur.copy(f"copy copy_in from stdin (format {format.name})") as copy:
224 copy.write(globals()[buffer])
225
226 cur.execute("select * from copy_in order by 1")
227 data = cur.fetchall()
228 assert data == sample_records
229
230
231def test_copy_in_buffers_pg_error(conn):

Callers

nothing calls this directly

Calls 6

ensure_tableFunction · 0.70
cursorMethod · 0.45
copyMethod · 0.45
writeMethod · 0.45
executeMethod · 0.45
fetchallMethod · 0.45

Tested by

no test coverage detected