Skip to content

Commit 3aabddc

Browse files
additional test fixes (for tests that changed or no longer exist on main)
1 parent d4938ea commit 3aabddc

File tree

6 files changed

+17
-9
lines changed

6 files changed

+17
-9
lines changed

pandas/tests/frame/methods/test_align.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import numpy as np
44
import pytest
55

6+
from pandas._config import using_string_dtype
7+
68
import pandas as pd
79
from pandas import (
810
DataFrame,
@@ -155,6 +157,7 @@ def test_align_series_condition(self):
155157
expected = DataFrame({"a": [0, 2, 0], "b": [0, 5, 0]})
156158
tm.assert_frame_equal(result, expected)
157159

160+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
158161
def test_align_int(self, int_frame):
159162
# test other non-float types
160163
other = DataFrame(index=range(5), columns=["A", "B", "C"])

pandas/tests/frame/methods/test_to_csv.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ def read_csv(self, path, **kwargs):
3535

3636
return read_csv(path, **params)
3737

38+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
3839
def test_to_csv_from_csv1(self, float_frame, datetime_frame):
3940
with tm.ensure_clean("__tmp_to_csv_from_csv1__") as path:
4041
float_frame.iloc[:5, float_frame.columns.get_loc("A")] = np.nan

pandas/tests/groupby/test_raises.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ def func(x):
219219
getattr(gb, how)(func)
220220

221221

222-
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
222+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)", strict=False)
223223
@pytest.mark.parametrize("how", ["agg", "transform"])
224224
@pytest.mark.parametrize("groupby_func_np", [np.sum, np.mean])
225225
def test_groupby_raises_string_np(

pandas/tests/io/test_pickle.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,10 +413,16 @@ def test_read(self, protocol, get_random_path):
413413
@pytest.mark.parametrize(
414414
["pickle_file", "excols"],
415415
[
416-
("test_py27.pkl", Index(["a", "b", "c"])),
416+
("test_py27.pkl", Index(["a", "b", "c"], dtype=object)),
417417
(
418418
"test_mi_py27.pkl",
419-
pd.MultiIndex.from_arrays([["a", "b", "c"], ["A", "B", "C"]]),
419+
pd.MultiIndex(
420+
[
421+
Index(["a", "b", "c"], dtype=object),
422+
Index(["A", "B", "C"], dtype=object),
423+
],
424+
[np.array([0, 1, 2]), np.array([0, 1, 2])],
425+
),
420426
),
421427
],
422428
)

pandas/tests/io/test_stata.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1563,8 +1563,8 @@ def test_path_pathlib(self):
15631563
def test_pickle_path_localpath(self):
15641564
df = DataFrame(
15651565
1.1 * np.arange(120).reshape((30, 4)),
1566-
columns=pd.Index(list("ABCD"), dtype=object),
1567-
index=pd.Index([f"i-{i}" for i in range(30)], dtype=object),
1566+
columns=pd.Index(list("ABCD")),
1567+
index=pd.Index([f"i-{i}" for i in range(30)]),
15681568
)
15691569
df.index.name = "index"
15701570
reader = lambda x: read_stata(x).set_index("index")

pandas/tests/tools/test_to_datetime.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1207,10 +1207,8 @@ def test_out_of_bounds_errors_ignore2(self):
12071207
# GH#12424
12081208
msg = "errors='ignore' is deprecated"
12091209
with tm.assert_produces_warning(FutureWarning, match=msg):
1210-
res = to_datetime(
1211-
Series(["2362-01-01", np.nan], dtype=object), errors="ignore"
1212-
)
1213-
exp = Series(["2362-01-01", np.nan], dtype=object)
1210+
res = to_datetime(Series(["2362-01-01", np.nan]), errors="ignore")
1211+
exp = Series(["2362-01-01", np.nan])
12141212
tm.assert_series_equal(res, exp)
12151213

12161214
def test_to_datetime_tz(self, cache):

0 commit comments

Comments
 (0)