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

TST(string dtype): Resolve xfails in test_to_csv #60683

Merged
merged 2 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pandas/tests/frame/methods/test_astype.py
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ def test_astype_tz_object_conversion(self, tz):
result = result.astype({"tz": "datetime64[ns, Europe/London]"})
tm.assert_frame_equal(result, expected)

@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string) GH#60639")
def test_astype_dt64_to_string(
self, frame_or_series, tz_naive_fixture, using_infer_string
):
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/frame/methods/test_reset_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ def test_rest_index_multiindex_categorical_with_missing_values(self, codes):
tm.assert_frame_equal(res, expected)


@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string) - GH#60338")
@pytest.mark.parametrize(
"array, dtype",
[
Expand Down
14 changes: 4 additions & 10 deletions pandas/tests/frame/methods/test_to_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
import numpy as np
import pytest

from pandas._config import using_string_dtype

from pandas.errors import ParserError

import pandas as pd
Expand Down Expand Up @@ -438,20 +436,18 @@ def test_to_csv_empty(self):
result, expected = self._return_result_expected(df, 1000)
tm.assert_frame_equal(result, expected, check_column_type=False)

@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
@pytest.mark.slow
def test_to_csv_chunksize(self):
chunksize = 1000
rows = chunksize // 2 + 1
df = DataFrame(
np.ones((rows, 2)),
columns=Index(list("ab"), dtype=object),
columns=Index(list("ab")),
index=MultiIndex.from_arrays([range(rows) for _ in range(2)]),
)
result, expected = self._return_result_expected(df, chunksize, rnlvl=2)
tm.assert_frame_equal(result, expected, check_names=False)

@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)", strict=False)
@pytest.mark.slow
@pytest.mark.parametrize(
"nrows", [2, 10, 99, 100, 101, 102, 198, 199, 200, 201, 202, 249, 250, 251]
Expand Down Expand Up @@ -480,7 +476,7 @@ def test_to_csv_params(self, nrows, df_params, func_params, ncols):
for _ in range(df_params["c_idx_nlevels"])
)
else:
columns = Index([f"i-{i}" for i in range(ncols)], dtype=object)
columns = Index([f"i-{i}" for i in range(ncols)])
df = DataFrame(np.ones((nrows, ncols)), index=index, columns=columns)
result, expected = self._return_result_expected(df, 1000, **func_params)
tm.assert_frame_equal(result, expected, check_names=False)
Expand Down Expand Up @@ -738,7 +734,6 @@ def test_to_csv_withcommas(self, temp_file):
df2 = self.read_csv(path)
tm.assert_frame_equal(df2, df)

@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
def test_to_csv_mixed(self, temp_file):
def create_cols(name):
return [f"{name}{i:03d}" for i in range(5)]
Expand All @@ -755,7 +750,7 @@ def create_cols(name):
)
df_bool = DataFrame(True, index=df_float.index, columns=create_cols("bool"))
df_object = DataFrame(
"foo", index=df_float.index, columns=create_cols("object")
"foo", index=df_float.index, columns=create_cols("object"), dtype="object"
)
df_dt = DataFrame(
Timestamp("20010101"),
Expand Down Expand Up @@ -824,13 +819,12 @@ def test_to_csv_dups_cols(self, temp_file):
result.columns = df.columns
tm.assert_frame_equal(result, df)

@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
def test_to_csv_dups_cols2(self, temp_file):
# GH3457
df = DataFrame(
np.ones((5, 3)),
index=Index([f"i-{i}" for i in range(5)], name="foo"),
columns=Index(["a", "a", "b"], dtype=object),
columns=Index(["a", "a", "b"]),
)

path = str(temp_file)
Expand Down
Loading