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

Function test_write_quoting_header

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

Source from the content-addressed store, hash-verified

2054
2055
2056def test_write_quoting_header():
2057 t = pa.Table.from_arrays([[1, 2, None], ["a", None, "c"]], ["c1", "c2"])
2058 buf = io.BytesIO()
2059 for write_options, res in [
2060 (WriteOptions(quoting_header='none'), b'c1,c2\n1,"a"\n2,\n,"c"\n'),
2061 (WriteOptions(), b'"c1","c2"\n1,"a"\n2,\n,"c"\n'),
2062 (WriteOptions(quoting_header='all_valid'),
2063 b'"c1","c2"\n1,"a"\n2,\n,"c"\n'),
2064 ]:
2065 with CSVWriter(buf, t.schema, write_options=write_options) as writer:
2066 writer.write_table(t)
2067 assert buf.getvalue() == res
2068 buf.seek(0)
2069
2070
2071def 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