Skip to content

Commit 8610cbd

Browse files
more xfails
1 parent dc7ae02 commit 8610cbd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+194
-12
lines changed

pandas/tests/apply/test_frame_apply.py

+6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import numpy as np
55
import pytest
66

7+
from pandas._config import using_string_dtype
8+
79
from pandas.core.dtypes.dtypes import CategoricalDtype
810

911
import pandas as pd
@@ -61,6 +63,7 @@ def test_apply(float_frame, engine, request):
6163
assert result.index is float_frame.index
6264

6365

66+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)", strict=False)
6467
@pytest.mark.parametrize("axis", [0, 1])
6568
@pytest.mark.parametrize("raw", [True, False])
6669
@pytest.mark.parametrize("nopython", [True, False])
@@ -1213,6 +1216,7 @@ def test_agg_with_name_as_column_name():
12131216
tm.assert_series_equal(result, expected)
12141217

12151218

1219+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
12161220
def test_agg_multiple_mixed():
12171221
# GH 20909
12181222
mdf = DataFrame(
@@ -1338,6 +1342,7 @@ def test_named_agg_reduce_axis1_raises(float_frame):
13381342
float_frame.agg(row1=(name1, "sum"), row2=(name2, "max"), axis=axis)
13391343

13401344

1345+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
13411346
def test_nuiscance_columns():
13421347
# GH 15015
13431348
df = DataFrame(
@@ -1514,6 +1519,7 @@ def test_apply_datetime_tz_issue(engine, request):
15141519
tm.assert_series_equal(result, expected)
15151520

15161521

1522+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)", strict=False)
15171523
@pytest.mark.parametrize("df", [DataFrame({"A": ["a", None], "B": ["c", "d"]})])
15181524
@pytest.mark.parametrize("method", ["min", "max", "sum"])
15191525
def test_mixed_column_raises(df, method, using_infer_string):

pandas/tests/apply/test_str.py

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import numpy as np
55
import pytest
66

7+
from pandas._config import using_string_dtype
8+
79
from pandas.compat import WASM
810

911
from pandas.core.dtypes.common import is_number
@@ -79,6 +81,7 @@ def test_apply_np_transformer(float_frame, op, how):
7981
tm.assert_frame_equal(result, expected)
8082

8183

84+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)", strict=False)
8285
@pytest.mark.parametrize(
8386
"series, func, expected",
8487
chain(
@@ -137,6 +140,7 @@ def test_agg_cython_table_series(series, func, expected):
137140
assert result == expected
138141

139142

143+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)", strict=False)
140144
@pytest.mark.parametrize(
141145
"series, func, expected",
142146
chain(

pandas/tests/arrays/categorical/test_analytics.py

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import numpy as np
55
import pytest
66

7+
from pandas._config import using_string_dtype
8+
79
from pandas.compat import PYPY
810

911
from pandas import (
@@ -294,6 +296,7 @@ def test_nbytes(self):
294296
exp = 3 + 3 * 8 # 3 int8s for values + 3 int64s for categories
295297
assert cat.nbytes == exp
296298

299+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
297300
def test_memory_usage(self):
298301
cat = Categorical([1, 2, 3])
299302

pandas/tests/arrays/categorical/test_api.py

+3
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
from pandas.compat import PY311
79

810
from pandas import (
@@ -149,6 +151,7 @@ def test_reorder_categories_raises(self, new_categories):
149151
with pytest.raises(ValueError, match=msg):
150152
cat.reorder_categories(new_categories)
151153

154+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
152155
def test_add_categories(self):
153156
cat = Categorical(["a", "b", "c", "a"], ordered=True)
154157
old = cat.copy()

pandas/tests/arrays/categorical/test_constructors.py

+1
Original file line numberDiff line numberDiff line change
@@ -735,6 +735,7 @@ def test_interval(self):
735735
tm.assert_numpy_array_equal(cat.codes, expected_codes)
736736
tm.assert_index_equal(cat.categories, idx)
737737

738+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
738739
def test_categorical_extension_array_nullable(self, nulls_fixture):
739740
# GH:
740741
arr = pd.arrays.StringArray._from_sequence(

pandas/tests/arrays/masked/test_function.py

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import numpy as np
22
import pytest
33

4+
from pandas._config import using_string_dtype
5+
46
from pandas.core.dtypes.common import is_integer_dtype
57

68
import pandas as pd
@@ -58,6 +60,7 @@ def test_tolist(data):
5860
tm.assert_equal(result, expected)
5961

6062

63+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
6164
def test_to_numpy():
6265
# GH#56991
6366

pandas/tests/dtypes/test_dtypes.py

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import numpy as np
55
import pytest
66

7+
from pandas._config import using_string_dtype
8+
79
from pandas._libs.tslibs.dtypes import NpyDatetimeUnit
810

911
from pandas.core.dtypes.base import _registry as registry
@@ -959,6 +961,7 @@ def test_same_categories_different_order(self):
959961
c2 = CategoricalDtype(["b", "a"], ordered=True)
960962
assert c1 is not c2
961963

964+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)", strict=False)
962965
@pytest.mark.parametrize("ordered2", [True, False, None])
963966
def test_categorical_equality(self, ordered, ordered2):
964967
# same categories, same order

pandas/tests/extension/test_string.py

+6
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,19 @@
2222
import numpy as np
2323
import pytest
2424

25+
from pandas._config import using_string_dtype
26+
2527
import pandas as pd
2628
import pandas._testing as tm
2729
from pandas.api.types import is_string_dtype
2830
from pandas.core.arrays import ArrowStringArray
2931
from pandas.core.arrays.string_ import StringDtype
3032
from pandas.tests.extension import base
3133

34+
pytestmark = pytest.mark.xfail(
35+
using_string_dtype(), reason="TODO(infer_string)", strict=False
36+
)
37+
3238

3339
def maybe_split_array(arr, chunked):
3440
if not chunked:

pandas/tests/frame/indexing/test_coercion.py

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
import numpy as np
99
import pytest
1010

11+
from pandas._config import using_string_dtype
12+
1113
import pandas as pd
1214
from pandas import (
1315
DataFrame,
@@ -82,6 +84,7 @@ def test_6942(indexer_al):
8284
assert df.iloc[0, 0] == t2
8385

8486

87+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
8588
def test_26395(indexer_al):
8689
# .at case fixed by GH#45121 (best guess)
8790
df = DataFrame(index=["A", "B", "C"])

pandas/tests/frame/indexing/test_indexing.py

+7
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
import numpy as np
1010
import pytest
1111

12+
from pandas._config import using_string_dtype
13+
1214
from pandas._libs import iNaT
1315
from pandas.errors import InvalidIndexError
1416

@@ -174,6 +176,7 @@ def test_getitem_boolean(self, mixed_float_frame, mixed_int_frame, datetime_fram
174176
if bif[c].dtype != bifw[c].dtype:
175177
assert bif[c].dtype == df[c].dtype
176178

179+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
177180
def test_getitem_boolean_casting(self, datetime_frame):
178181
# don't upcast if we don't need to
179182
df = datetime_frame.copy()
@@ -501,6 +504,7 @@ def test_setitem_ambig(self, using_infer_string):
501504
else:
502505
assert dm[2].dtype == np.object_
503506

507+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
504508
def test_setitem_None(self, float_frame, using_infer_string):
505509
# GH #766
506510
float_frame[None] = float_frame["A"]
@@ -1121,6 +1125,7 @@ def test_setitem_with_unaligned_tz_aware_datetime_column(self):
11211125
df.loc[[0, 1, 2], "dates"] = column[[1, 0, 2]]
11221126
tm.assert_series_equal(df["dates"], column)
11231127

1128+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
11241129
def test_loc_setitem_datetimelike_with_inference(self):
11251130
# GH 7592
11261131
# assignment of timedeltas with NaT
@@ -1143,6 +1148,7 @@ def test_loc_setitem_datetimelike_with_inference(self):
11431148
)
11441149
tm.assert_series_equal(result, expected)
11451150

1151+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
11461152
def test_getitem_boolean_indexing_mixed(self):
11471153
df = DataFrame(
11481154
{
@@ -1871,6 +1877,7 @@ def test_adding_new_conditional_column_with_string(dtype, infer_string) -> None:
18711877
tm.assert_frame_equal(df, expected)
18721878

18731879

1880+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
18741881
def test_add_new_column_infer_string():
18751882
# GH#55366
18761883
pytest.importorskip("pyarrow")

pandas/tests/frame/indexing/test_insert.py

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
import numpy as np
88
import pytest
99

10+
from pandas._config import using_string_dtype
11+
1012
from pandas.errors import PerformanceWarning
1113

1214
from pandas import (
@@ -61,6 +63,7 @@ def test_insert_column_bug_4032(self):
6163
expected = DataFrame([[1.3, 1, 1.1], [2.3, 2, 2.2]], columns=["c", "a", "b"])
6264
tm.assert_frame_equal(result, expected)
6365

66+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
6467
def test_insert_with_columns_dups(self):
6568
# GH#14291
6669
df = DataFrame()

pandas/tests/frame/indexing/test_setitem.py

+8
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
from pandas.core.dtypes.base import _registry as ea_registry
79
from pandas.core.dtypes.common import is_object_dtype
810
from pandas.core.dtypes.dtypes import (
@@ -144,6 +146,7 @@ def test_setitem_different_dtype(self):
144146
)
145147
tm.assert_series_equal(result, expected)
146148

149+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
147150
def test_setitem_empty_columns(self):
148151
# GH 13522
149152
df = DataFrame(index=["A", "B", "C"])
@@ -159,6 +162,7 @@ def test_setitem_dt64_index_empty_columns(self):
159162
df["A"] = rng
160163
assert df["A"].dtype == np.dtype("M8[ns]")
161164

165+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
162166
def test_setitem_timestamp_empty_columns(self):
163167
# GH#19843
164168
df = DataFrame(index=range(3))
@@ -198,6 +202,7 @@ def test_setitem_with_unaligned_sparse_value(self):
198202
expected = Series(SparseArray([1, 0, 0]), name="new_column")
199203
tm.assert_series_equal(df["new_column"], expected)
200204

205+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
201206
def test_setitem_period_preserves_dtype(self):
202207
# GH: 26861
203208
data = [Period("2003-12", "D")]
@@ -667,6 +672,7 @@ def test_setitem_iloc_two_dimensional_generator(self):
667672
expected = DataFrame({"a": [1, 2, 3], "b": [4, 1, 1]})
668673
tm.assert_frame_equal(df, expected)
669674

675+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
670676
def test_setitem_dtypes_bytes_type_to_object(self):
671677
# GH 20734
672678
index = Series(name="id", dtype="S24")
@@ -699,6 +705,7 @@ def test_setitem_ea_dtype_rhs_series(self):
699705
expected = DataFrame({"a": [1, 2]}, dtype="Int64")
700706
tm.assert_frame_equal(df, expected)
701707

708+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
702709
def test_setitem_npmatrix_2d(self):
703710
# GH#42376
704711
# for use-case df["x"] = sparse.random((10, 10)).mean(axis=1)
@@ -920,6 +927,7 @@ def test_setitem_with_expansion_categorical_dtype(self):
920927
ser.name = "E"
921928
tm.assert_series_equal(result2.sort_index(), ser.sort_index())
922929

930+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
923931
def test_setitem_scalars_no_index(self):
924932
# GH#16823 / GH#17894
925933
df = DataFrame()

pandas/tests/frame/indexing/test_where.py

+5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import numpy as np
55
import pytest
66

7+
from pandas._config import using_string_dtype
8+
79
from pandas.core.dtypes.common import is_scalar
810

911
import pandas as pd
@@ -46,6 +48,7 @@ def is_ok(s):
4648

4749

4850
class TestDataFrameIndexingWhere:
51+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)", strict=False)
4952
def test_where_get(self, where_frame, float_string_frame):
5053
def _check_get(df, cond, check_dtypes=True):
5154
other1 = _safe_add(df)
@@ -96,6 +99,7 @@ def test_where_upcasting(self):
9699

97100
tm.assert_series_equal(result, expected)
98101

102+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)", strict=False)
99103
def test_where_alignment(self, where_frame, float_string_frame):
100104
# aligning
101105
def _check_align(df, cond, other, check_dtypes=True):
@@ -170,6 +174,7 @@ def test_where_invalid(self):
170174
with pytest.raises(ValueError, match=msg):
171175
df.mask(0)
172176

177+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)", strict=False)
173178
def test_where_set(self, where_frame, float_string_frame, mixed_int_frame):
174179
# where inplace
175180

pandas/tests/frame/indexing/test_xs.py

+3
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
from pandas import (
79
DataFrame,
810
Index,
@@ -72,6 +74,7 @@ def test_xs_other(self, float_frame):
7274
tm.assert_series_equal(float_frame["A"], float_frame_orig["A"])
7375
assert not (expected == 5).all()
7476

77+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
7578
def test_xs_corner(self):
7679
# pathological mixed-type reordering case
7780
df = DataFrame(index=[0])

pandas/tests/frame/methods/test_combine_first.py

+3
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
from pandas.core.dtypes.cast import find_common_type
79
from pandas.core.dtypes.common import is_dtype_equal
810

@@ -30,6 +32,7 @@ def test_combine_first_mixed(self):
3032
combined = f.combine_first(g)
3133
tm.assert_frame_equal(combined, exp)
3234

35+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
3336
def test_combine_first(self, float_frame, using_infer_string):
3437
# disjoint
3538
head, tail = float_frame[:5], float_frame[5:]

pandas/tests/frame/methods/test_convert_dtypes.py

+4
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
import pandas._testing as tm
810

@@ -180,6 +182,7 @@ def test_convert_dtypes_pyarrow_timestamp(self):
180182
result = expected.convert_dtypes(dtype_backend="pyarrow")
181183
tm.assert_series_equal(result, expected)
182184

185+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
183186
def test_convert_dtypes_avoid_block_splitting(self):
184187
# GH#55341
185188
df = pd.DataFrame({"a": [1, 2, 3], "b": [4, 5, 6], "c": "a"})
@@ -194,6 +197,7 @@ def test_convert_dtypes_avoid_block_splitting(self):
194197
tm.assert_frame_equal(result, expected)
195198
assert result._mgr.nblocks == 2
196199

200+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
197201
def test_convert_dtypes_from_arrow(self):
198202
# GH#56581
199203
df = pd.DataFrame([["a", datetime.time(18, 12)]], columns=["a", "b"])

0 commit comments

Comments
 (0)