frederickjansen commented on code in PR #14722:
URL: https://github.com/apache/arrow/pull/14722#discussion_r1034034754
##########
python/pyarrow/tests/test_csv.py:
##########
@@ -1908,6 +1908,20 @@ def test_write_read_round_trip():
parse_options=parse_options)
+def test_write_quoting_style():
+ t = pa.Table.from_arrays([[1, 2, 3], ["a", "b", "c"]], ["c1", "c2"])
+ buf = io.BytesIO()
+ for write_options, res in [
+ (WriteOptions(quoting_style='none'), b'"c1","c2"\n1,a\n2,b\n3,c\n'),
+ (WriteOptions(), b'"c1","c2"\n1,"a"\n2,"b"\n3,"c"\n'),
+ (WriteOptions(quoting_style='all_valid'),
b'"c1","c2"\n"1","a"\n"2","b"\n"3","c"\n'),
+ ]:
+ with CSVWriter(buf, t.schema, write_options=write_options) as writer:
+ writer.write_table(t)
+ buf.seek(0)
Review Comment:
I believe it's still needed to start writing from the start of the buffer
again in the next loop. Otherwise the buffer contains the contents of the
previous test. I could put the call after `getvalue()` as well if that makes it
more clear.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]