Skip to content

Commit

Permalink
TEST-modin-project#2295: minor corrections
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Myskov <alexander.myskov@intel.com>
  • Loading branch information
amyskov committed Dec 3, 2020
1 parent f64d142 commit 2bd0308
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
23 changes: 11 additions & 12 deletions modin/pandas/test/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
IO_OPS_DATA_DIR,
io_ops_bad_exc,
eval_io_from_str,
comp_to_ext,
)

from modin.config import Engine, Backend, IsExperimental
Expand Down Expand Up @@ -75,16 +76,6 @@

# Number of rows in the test file
NROWS = DATASET_SIZE_DICT.get(TestDatasetSize.get(), DATASET_SIZE_DICT["Small"])
comp_to_ext = {"infer": "", "gzip": "gz", "bz2": "bz2", "xz": "xz", "zip": "zip"}

test_csv_dialect_params = {
"delimiter": "_",
"doublequote": False,
"escapechar": "d",
"quotechar": "d",
"quoting": csv.QUOTE_ALL,
}
csv.register_dialect("test_csv_dialect", **test_csv_dialect_params)

if not os.path.exists(IO_OPS_DATA_DIR):
os.mkdir(IO_OPS_DATA_DIR)
Expand Down Expand Up @@ -250,7 +241,6 @@ def _csv_file_maker(
if compression != "infer"
else filename
)

df.to_csv(
filename,
sep=delimiter,
Expand Down Expand Up @@ -876,6 +866,7 @@ def test_read_csv_iteration(self, make_csv_file, iterator):
pd_df = pd_reader.read()

df_equals(modin_df, pd_df)

# Quoting, Compression, and File Format parameters tests
@pytest.mark.parametrize("compression", ["infer", "gzip", "bz2", "xz", "zip"])
@pytest.mark.parametrize(
Expand Down Expand Up @@ -926,11 +917,19 @@ def test_read_csv_file_format(
pytest.xfail("read_csv with Ray engine outputs empty frame - issue #2493")
elif Engine.get() != "Python" and escapechar:
pytest.xfail(
"read_csv with Ray engine fails with some 'escapechar' parameter - issue #2494"
"read_csv with Ray engine fails with some 'escapechar' parameters - issue #2494"
)

unique_filename = get_unique_filename()
if dialect:
test_csv_dialect_params = {
"delimiter": "_",
"doublequote": False,
"escapechar": "d",
"quotechar": "d",
"quoting": csv.QUOTE_ALL,
}
csv.register_dialect(dialect, **test_csv_dialect_params)
make_csv_file(filename=unique_filename, **test_csv_dialect_params)
else:
make_csv_file(
Expand Down
3 changes: 3 additions & 0 deletions modin/pandas/test/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,9 @@
# the type of this exceptions are the same
io_ops_bad_exc = [TypeError, FileNotFoundError]

# Files compression to extension mapping
comp_to_ext = {"gzip": "gz", "bz2": "bz2", "xz": "xz", "zip": "zip"}


def categories_equals(left, right):
assert (left.ordered and right.ordered) or (not left.ordered and not right.ordered)
Expand Down

0 comments on commit 2bd0308

Please sign in to comment.