Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TEST-#6996: Update tests in test_io.py #6997

Merged
merged 3 commits into from Mar 5, 2024

Conversation

anmyachev
Copy link
Collaborator

@anmyachev anmyachev commented Mar 4, 2024

What do these changes do?

  • first commit message and PR title follow format outlined here

    NOTE: If you edit the PR title to match this format, you need to add another commit (even if it's empty) or amend your last commit for the CI job that checks the PR title to pick up the new PR title.

  • passes flake8 modin/ asv_bench/benchmarks scripts/doc_checker.py
  • passes black --check modin/ asv_bench/benchmarks scripts/doc_checker.py
  • signed commit with git commit -s
  • Resolves Update tests in test_io.py #6996
  • tests added and passing
  • module layout described at docs/development/architecture.rst is up-to-date

Comment on lines -262 to -263
@pytest.mark.parametrize("sep", [None, "_", ",", ".", "\n"])
@pytest.mark.parametrize("delimiter", ["_", ",", ".", "\n"])
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These parameters mean the same thing. When using them at the same time, an exception occurs - I put it in a separate test.

@@ -303,7 +311,7 @@ def comparator(df1, df2):
@pytest.mark.parametrize("header", ["infer", None, 0])
@pytest.mark.parametrize("index_col", [None, "col1"])
@pytest.mark.parametrize(
"names", [lib.no_default, ["col1"], ["c1", "c2", "c3", "c4", "c5", "c6", "c7"]]
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The last column is missing, this is a test to reproduce the same error as in pandas. It is redundant to test this situation with all combinations of parameters in this test.

# Internal parameters tests
@pytest.mark.parametrize("use_str_data", [True, False])
@pytest.mark.parametrize("engine", [None, "python", "c"])
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many parameters are not implemented for the python engine (and exceptions are thrown), moved to separate tests above.

@@ -2756,20 +2767,19 @@ def test_fwf_file_usecols(self, make_fwf_file, usecols):
"dtype_backend", [lib.no_default, "numpy_nullable", "pyarrow"]
)
def test_read_fwf_dtype_backend(self, make_fwf_file, dtype_backend):
with ensure_clean(".fwf") as unique_filename:
make_fwf_file(filename=unique_filename)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make_fwf_file fixture doesn't actually take a filename as a parameter.

Signed-off-by: Anatoly Myachev <anatoly.myachev@intel.com>
Signed-off-by: Anatoly Myachev <anatoly.myachev@intel.com>
@anmyachev anmyachev marked this pull request as ready for review March 4, 2024 14:52
def test_read_csv_delimiters(
self, make_csv_file, sep, delimiter, decimal, thousands
):
def test_read_csv_delimiters(self, make_csv_file, sep, decimal, thousands):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def test_read_csv_delimiters(self, make_csv_file, sep, decimal, thousands):
def test_read_csv_seps(self, make_csv_file, sep, decimal, thousands):

Should we rename this test for consistency with the parameter? or just rename the parameter name sep to delimeter.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renamed

@@ -794,75 +802,64 @@ def test_read_csv_error_handling(self, on_bad_lines):
on_bad_lines=on_bad_lines,
)

@pytest.mark.parametrize("float_precision", [None, "high", "legacy", "round_trip"])
def test_python_engine_float_precision_except(self, float_precision):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you elaborate on why python engine only?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already tested python engine in test_read_csv_internal, but I moved it to a separate test. Reason: #6997 (comment)

)

@pytest.mark.parametrize("low_memory", [False, True])
def test_python_engine_low_memory_except(self, low_memory):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already tested python engine in test_read_csv_internal, but I moved it to a separate test. Reason: #6997 (comment)

@@ -3095,6 +3097,12 @@ def test_read_xml(self):
<degrees>360</degrees>
<sides/>
</row>
<row>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this added?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The example is outdated, I took the updated one from https://pandas.pydata.org/docs/reference/api/pandas.read_xml.html#pandas-read-xml.

Signed-off-by: Anatoly Myachev <anatoly.myachev@intel.com>
@YarShev YarShev merged commit 0b6c8e4 into modin-project:master Mar 5, 2024
37 checks passed
@anmyachev anmyachev deleted the issue6996 branch March 5, 2024 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update tests in test_io.py
2 participants