pitrou commented on a change in pull request #10794:
URL: https://github.com/apache/arrow/pull/10794#discussion_r699493243
##########
File path: python/pyarrow/tests/test_csv.py
##########
@@ -321,156 +322,31 @@ def test_write_options():
opts.validate()
-class BaseTestCSV:
- """Common tests which are shared by streaming and non streaming readers"""
-
- def base_row_number_offset_in_errors(self, use_threads, read_bytes,
- num_blocks=3):
- """
- num_blocks is a temporary work around because streaming reader does
- not get schema from first non empty block
- """
-
- # Row numbers are only correctly counted in serial reads
- def format_msg(msg_format, row, *args):
- if use_threads:
- row_info = ""
- else:
- row_info = "Row #{}: ".format(row)
- return msg_format.format(row_info, *args)
-
- csv, _ = make_random_csv(4, 100, write_names=True)
-
- read_options = ReadOptions()
- read_options.block_size = len(csv) / num_blocks
- convert_options = ConvertOptions()
- convert_options.column_types = {"a": pa.int32()}
-
- # Test without skip_rows and column names in the csv
- csv_bad_columns = csv + b"1,2\r\n"
- message_columns = format_msg("{}Expected 4 columns, got 2", 102)
- with pytest.raises(pa.ArrowInvalid, match=message_columns):
- read_bytes(csv_bad_columns, read_options=read_options,
- convert_options=convert_options)
-
- csv_bad_type = csv + b"a,b,c,d\r\n"
- message_value = format_msg(
- "In CSV column #0: {}"
- "CSV conversion error to int32: invalid value 'a'",
- 102, csv)
- with pytest.raises(pa.ArrowInvalid, match=message_value):
- read_bytes(csv_bad_type, read_options=read_options,
- convert_options=convert_options)
-
- long_row = (b"this is a long row" * 15) + b",3\r\n"
- csv_bad_columns_long = csv + long_row
- message_long = format_msg("{}Expected 4 columns, got 2: {} ...", 102,
- long_row[0:96].decode("utf-8"))
- with pytest.raises(pa.ArrowInvalid, match=message_long):
- read_bytes(csv_bad_columns_long, read_options=read_options,
- convert_options=convert_options)
[email protected](params=[True, False], ids=['threaded', 'serial'])
+def use_threads(request):
+ return request.param
Review comment:
Thank you very much @n3world !
--
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]