Skip to content

Commit e8028bc

Browse files
additional test fixes (for tests that changed or no longer exist on main)
1 parent 5ce289d commit e8028bc

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

pandas/tests/frame/methods/test_quantile.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,6 @@ def test_quantile_multi_empty(self, interp_method):
354354
)
355355
tm.assert_frame_equal(result, expected)
356356

357-
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
358357
def test_quantile_datetime(self, unit):
359358
dti = pd.to_datetime(["2010", "2011"]).as_unit(unit)
360359
df = DataFrame({"a": dti, "b": [0, 5]})
@@ -408,7 +407,6 @@ def test_quantile_datetime(self, unit):
408407
expected = DataFrame(index=[0.5], columns=[])
409408
tm.assert_frame_equal(result, expected)
410409

411-
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
412410
@pytest.mark.parametrize(
413411
"dtype",
414412
[
@@ -679,7 +677,6 @@ def test_quantile_nat(self, interp_method, request, using_array_manager, unit):
679677
)
680678
tm.assert_frame_equal(res, exp)
681679

682-
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
683680
def test_quantile_empty_no_rows_floats(self, interp_method):
684681
interpolation, method = interp_method
685682

pandas/tests/groupby/test_apply.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
import numpy as np
77
import pytest
88

9+
from pandas._config import using_string_dtype
10+
911
import pandas as pd
1012
from pandas import (
1113
DataFrame,
@@ -126,7 +128,7 @@ def test_apply_trivial(using_infer_string):
126128
{"key": ["a", "a", "b", "b", "a"], "data": [1.0, 2.0, 3.0, 4.0, 5.0]},
127129
columns=["key", "data"],
128130
)
129-
dtype = "string" if using_infer_string else "object"
131+
dtype = "str" if using_infer_string else "object"
130132
expected = pd.concat([df.iloc[1:], df.iloc[1:]], axis=1, keys=["float64", dtype])
131133

132134
msg = "DataFrame.groupby with axis=1 is deprecated"
@@ -143,7 +145,7 @@ def test_apply_trivial_fail(using_infer_string):
143145
{"key": ["a", "a", "b", "b", "a"], "data": [1.0, 2.0, 3.0, 4.0, 5.0]},
144146
columns=["key", "data"],
145147
)
146-
dtype = "string" if using_infer_string else "object"
148+
dtype = "str" if using_infer_string else "object"
147149
expected = pd.concat([df, df], axis=1, keys=["float64", dtype])
148150
msg = "DataFrame.groupby with axis=1 is deprecated"
149151
with tm.assert_produces_warning(FutureWarning, match=msg):
@@ -1299,12 +1301,13 @@ def test_apply_dropna_with_indexed_same(dropna):
12991301
@pytest.mark.parametrize(
13001302
"as_index, expected",
13011303
[
1302-
[
1304+
pytest.param(
13031305
False,
13041306
DataFrame(
13051307
[[1, 1, 1], [2, 2, 1]], columns=Index(["a", "b", None], dtype=object)
13061308
),
1307-
],
1309+
marks=pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)"),
1310+
),
13081311
[
13091312
True,
13101313
Series(

pandas/tests/indexing/test_coercion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -834,6 +834,7 @@ def replacer(self, how, from_key, to_key):
834834
def test_replace_series(self, how, to_key, from_key, replacer):
835835
index = pd.Index([3, 4], name="xxx")
836836
obj = pd.Series(self.rep[from_key], index=index, name="yyy")
837+
obj = obj.astype(from_key)
837838
assert obj.dtype == from_key
838839

839840
if from_key.startswith("datetime") and to_key.startswith("datetime"):
@@ -854,7 +855,6 @@ def test_replace_series(self, how, to_key, from_key, replacer):
854855

855856
else:
856857
exp = pd.Series(self.rep[to_key], index=index, name="yyy")
857-
assert exp.dtype == to_key
858858

859859
msg = "Downcasting behavior in `replace`"
860860
warn = FutureWarning

pandas/tests/io/parser/common/test_file_buffer_url.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ def test_path_local_path(all_parsers):
8787
parser = all_parsers
8888
df = DataFrame(
8989
1.1 * np.arange(120).reshape((30, 4)),
90-
columns=Index(list("ABCD"), dtype=object),
91-
index=Index([f"i-{i}" for i in range(30)], dtype=object),
90+
columns=Index(list("ABCD")),
91+
index=Index([f"i-{i}" for i in range(30)]),
9292
)
9393
result = tm.round_trip_localpath(
9494
df.to_csv, lambda p: parser.read_csv(p, index_col=0)

0 commit comments

Comments
 (0)