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

Function test_write_eol

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

Source from the content-addressed store, hash-verified

2140
2141
2142def test_write_eol():
2143 t = pa.Table.from_arrays([[1, 2, 3], ["a", "b", "c"]], ["c1", "c2"])
2144 buf = io.BytesIO()
2145 for write_options, res in [
2146 (WriteOptions(), b'"c1","c2"\n1,"a"\n2,"b"\n3,"c"\n'),
2147 (WriteOptions(eol='\n'), b'"c1","c2"\n1,"a"\n2,"b"\n3,"c"\n'),
2148 (WriteOptions(eol='\r\n'),
2149 b'"c1","c2"\r\n1,"a"\r\n2,"b"\r\n3,"c"\r\n'),
2150 (WriteOptions(eol='*'), b'"c1","c2"*1,"a"*2,"b"*3,"c"*'),
2151 ]:
2152 with CSVWriter(buf, t.schema, write_options=write_options) as writer:
2153 writer.write_table(t)
2154 assert buf.getvalue() == res
2155 buf.seek(0)
2156 buf.truncate()
2157
2158
2159def test_write_null_string():

Callers

nothing calls this directly

Calls 3

WriteOptionsClass · 0.90
seekMethod · 0.80
write_tableMethod · 0.45

Tested by

no test coverage detected