frederickjansen commented on code in PR #14722:
URL: https://github.com/apache/arrow/pull/14722#discussion_r1034090597
##########
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"])
Review Comment:
Done
##########
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():
Review Comment:
Done
##########
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)
+ assert buf.getvalue() == res
+
Review Comment:
Added another test with comma and double quote, which does indeed raise with
`quoting_style='none'`.
--
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]