MCPcopy
hub / github.com/psycopg/psycopg / test_copy_in_allchars

Function test_copy_in_allchars

tests/test_copy.py:558–573  ·  view source on GitHub ↗
(conn)

Source from the content-addressed store, hash-verified

556
557
558def test_copy_in_allchars(conn):
559 cur = conn.cursor()
560 ensure_table(cur, sample_tabledef)
561
562 conn.execute("set client_encoding to utf8")
563 with cur.copy("copy copy_in from stdin (format text)") as copy:
564 for i in range(1, 256):
565 copy.write_row((i, None, chr(i)))
566 copy.write_row((ord(eur), None, eur))
567
568 cur.execute("""
569select col1 = ascii(data), col2 is null, length(data), count(*)
570from copy_in group by 1, 2, 3
571""")
572 data = cur.fetchall()
573 assert data == [(True, True, 1, 256)]
574
575
576def test_copy_in_format(conn):

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected