MCPcopy Create free account
hub / github.com/apache/arrow / test_write_quoting_header

Function test_write_quoting_header

python/pyarrow/tests/test_csv.py:2126–2138  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2124
2125
2126def test_write_quoting_header():
2127 t = pa.Table.from_arrays([[1, 2, None], ["a", None, "c"]], ["c1", "c2"])
2128 buf = io.BytesIO()
2129 for write_options, res in [
2130 (WriteOptions(quoting_header='none'), b'c1,c2\n1,"a"\n2,\n,"c"\n'),
2131 (WriteOptions(), b'"c1","c2"\n1,"a"\n2,\n,"c"\n'),
2132 (WriteOptions(quoting_header='all_valid'),
2133 b'"c1","c2"\n1,"a"\n2,\n,"c"\n'),
2134 ]:
2135 with CSVWriter(buf, t.schema, write_options=write_options) as writer:
2136 writer.write_table(t)
2137 assert buf.getvalue() == res
2138 buf.seek(0)
2139
2140
2141def test_read_csv_reference_cycle():

Callers

nothing calls this directly

Calls 3

WriteOptionsClass · 0.90
seekMethod · 0.80
write_tableMethod · 0.45

Tested by

no test coverage detected