| 441 | |
| 442 | @pytest.mark.parametrize("format", pq.Format) |
| 443 | def test_copy_in_records(conn, format): |
| 444 | cur = conn.cursor() |
| 445 | ensure_table(cur, sample_tabledef) |
| 446 | |
| 447 | with cur.copy(f"copy copy_in from stdin (format {format.name})") as copy: |
| 448 | for row in sample_records: |
| 449 | if format == pq.Format.BINARY: |
| 450 | row2 = tuple((Int4(i) if isinstance(i, int) else i for i in row)) |
| 451 | row = row2 # type: ignore[assignment] |
| 452 | copy.write_row(row) |
| 453 | |
| 454 | cur.execute("select * from copy_in order by 1") |
| 455 | data = cur.fetchall() |
| 456 | assert data == sample_records |
| 457 | |
| 458 | |
| 459 | @pytest.mark.parametrize("format", pq.Format) |