Skip to content

Commit

Permalink
FIX-#2508: Defaults to pandas for read_csv if dialect!=None (#5512)
Browse files Browse the repository at this point in the history
Signed-off-by: Anatoly Myachev <anatoly.myachev@intel.com>
  • Loading branch information
anmyachev committed Jan 4, 2023
1 parent d064828 commit e00b516
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
3 changes: 3 additions & 0 deletions modin/core/io/text/text_file_dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,9 @@ def check_parameters_support(
if read_kwargs["chunksize"] is not None:
return (False, "`chunksize` parameter is not supported")

if read_kwargs.get("dialect") is not None:
return (False, "`dialect` parameter is not supported")

if read_kwargs["lineterminator"] is not None:
return (False, "`lineterminator` parameter is not supported")

Expand Down
10 changes: 4 additions & 6 deletions modin/pandas/test/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ def test_read_csv_encoding(self, make_csv_file, encoding):
@pytest.mark.parametrize("decimal", [".", "_"])
@pytest.mark.parametrize("lineterminator", [None, "x", "\n"])
@pytest.mark.parametrize("escapechar", [None, "d", "x"])
@pytest.mark.parametrize("dialect", ["test_csv_dialect", None])
@pytest.mark.parametrize("dialect", ["test_csv_dialect", "use_dialect_name", None])
def test_read_csv_file_format(
self,
make_csv_file,
Expand All @@ -719,10 +719,6 @@ def test_read_csv_file_format(
pytest.xfail(
"read_csv with Ray engine fails with some 'escapechar' parameters - issue #2494"
)
elif Engine.get() != "Python" and dialect:
pytest.xfail(
"read_csv with Ray engine fails with `dialect` parameter - issue #2508"
)

with ensure_clean(".csv") as unique_filename:
if dialect:
Expand All @@ -734,7 +730,9 @@ def test_read_csv_file_format(
"quoting": csv.QUOTE_ALL,
}
csv.register_dialect(dialect, **test_csv_dialect_params)
dialect = csv.get_dialect(dialect)
if dialect != "use_dialect_name":
# otherwise try with dialect name instead of `_csv.Dialect` object
dialect = csv.get_dialect(dialect)
make_csv_file(filename=unique_filename, **test_csv_dialect_params)
else:
make_csv_file(
Expand Down

0 comments on commit e00b516

Please sign in to comment.