Skip to content

Commit 0167265

Browse files
WillAydmroeschke
authored andcommitted
TST (string dtype): xfail all currently failing tests with future.infer_string (#59329)
* TST (string dtype): xfail all currently failing tests with future.infer_string * more xfails * more xfails * add missing strict=False * also run slow and single cpu tests * fix single_cpu tests * xfail some slow tests * stop suppressing non-zero exit code from pytest on string CI build * remove accidentally added xlsx file --------- Co-authored-by: Matthew Roeschke <[email protected]>
1 parent e5c6a08 commit 0167265

File tree

131 files changed

+539
-23
lines changed

Some content is hidden

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

131 files changed

+539
-23
lines changed

.github/workflows/unit-tests.yml

-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ jobs:
8787
pandas_copy_on_write: "warn"
8888
- name: "Future infer strings"
8989
env_file: actions-311.yaml
90-
pattern: "not slow and not network and not single_cpu"
9190
pandas_future_infer_string: "1"
9291
- name: "Pypy"
9392
env_file: actions-pypy-39.yaml

ci/run_tests.sh

-6
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,5 @@ if [[ "$PATTERN" ]]; then
1616
PYTEST_CMD="$PYTEST_CMD -m \"$PATTERN\""
1717
fi
1818

19-
# temporarily let pytest always succeed (many tests are not yet passing in the
20-
# build enabling the future string dtype)
21-
if [[ "$PANDAS_FUTURE_INFER_STRING" == "1" ]]; then
22-
PYTEST_CMD="$PYTEST_CMD || true"
23-
fi
24-
2519
echo $PYTEST_CMD
2620
sh -c "$PYTEST_CMD"

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
def test_apply_args(float_frame, axis, raw, engine, request):
@@ -1169,6 +1172,7 @@ def test_agg_with_name_as_column_name():
11691172
tm.assert_series_equal(result, expected)
11701173

11711174

1175+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
11721176
def test_agg_multiple_mixed():
11731177
# GH 20909
11741178
mdf = DataFrame(
@@ -1286,6 +1290,7 @@ def test_agg_reduce(axis, float_frame):
12861290
tm.assert_frame_equal(result, expected)
12871291

12881292

1293+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
12891294
def test_nuiscance_columns():
12901295
# GH 15015
12911296
df = DataFrame(
@@ -1462,6 +1467,7 @@ def test_apply_datetime_tz_issue(engine, request):
14621467
tm.assert_series_equal(result, expected)
14631468

14641469

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

pandas/tests/apply/test_numba.py

+4
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
import pandas.util._test_decorators as td
57

68
from pandas import (
@@ -17,6 +19,7 @@ def apply_axis(request):
1719
return request.param
1820

1921

22+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
2023
def test_numba_vs_python_noop(float_frame, apply_axis):
2124
func = lambda x: x
2225
result = float_frame.apply(func, engine="numba", axis=apply_axis)
@@ -40,6 +43,7 @@ def test_numba_vs_python_string_index():
4043
)
4144

4245

46+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
4347
def test_numba_vs_python_indexing():
4448
frame = DataFrame(
4549
{"a": [1, 2, 3], "b": [4, 5, 6], "c": [7.0, 8.0, 9.0]},

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.core.dtypes.common import is_number
810

911
from pandas import (
@@ -86,6 +88,7 @@ def test_apply_np_transformer(float_frame, op, how):
8688
tm.assert_frame_equal(result, expected)
8789

8890

91+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)", strict=False)
8992
@pytest.mark.parametrize(
9093
"series, func, expected",
9194
chain(
@@ -144,6 +147,7 @@ def test_agg_cython_table_series(series, func, expected):
144147
assert result == expected
145148

146149

150+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)", strict=False)
147151
@pytest.mark.parametrize(
148152
"series, func, expected",
149153
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 (
@@ -296,6 +298,7 @@ def test_nbytes(self):
296298
exp = 3 + 3 * 8 # 3 int8s for values + 3 int64s for categories
297299
assert cat.nbytes == exp
298300

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

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 (
@@ -156,6 +158,7 @@ def test_reorder_categories_raises(self, new_categories):
156158
with pytest.raises(ValueError, match=msg):
157159
cat.reorder_categories(new_categories)
158160

161+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
159162
def test_add_categories(self):
160163
cat = Categorical(["a", "b", "c", "a"], ordered=True)
161164
old = cat.copy()

pandas/tests/arrays/categorical/test_constructors.py

+1
Original file line numberDiff line numberDiff line change
@@ -743,6 +743,7 @@ def test_interval(self):
743743
tm.assert_numpy_array_equal(cat.codes, expected_codes)
744744
tm.assert_index_equal(cat.categories, idx)
745745

746+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
746747
def test_categorical_extension_array_nullable(self, nulls_fixture):
747748
# GH:
748749
arr = pd.arrays.StringArray._from_sequence(

pandas/tests/arrays/floating/test_arithmetic.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
import pandas as pd
79
import pandas._testing as tm
810
from pandas.core.arrays import FloatingArray
@@ -122,6 +124,7 @@ def test_arith_zero_dim_ndarray(other):
122124
# -----------------------------------------------------------------------------
123125

124126

127+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)", strict=False)
125128
def test_error_invalid_values(data, all_arithmetic_operators, using_infer_string):
126129
op = all_arithmetic_operators
127130
s = pd.Series(data)

pandas/tests/arrays/integer/test_arithmetic.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
import pandas as pd
79
import pandas._testing as tm
810
from pandas.core import ops
@@ -172,6 +174,7 @@ def test_numpy_zero_dim_ndarray(other):
172174
# -----------------------------------------------------------------------------
173175

174176

177+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)", strict=False)
175178
def test_error_invalid_values(data, all_arithmetic_operators, using_infer_string):
176179
op = all_arithmetic_operators
177180
s = pd.Series(data)

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/copy_view/test_array.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 import (
57
DataFrame,
68
Series,
@@ -157,6 +159,7 @@ def test_dataframe_array_ea_dtypes(using_copy_on_write):
157159
assert arr.flags.writeable is True
158160

159161

162+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
160163
def test_dataframe_array_string_dtype(using_copy_on_write, using_array_manager):
161164
df = DataFrame({"a": ["a", "b"]}, dtype="string")
162165
arr = np.asarray(df)

pandas/tests/copy_view/test_astype.py

+6
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.pyarrow import pa_version_under12p0
79
import pandas.util._test_decorators as td
810

@@ -96,6 +98,7 @@ def test_astype_numpy_to_ea():
9698
assert np.shares_memory(get_array(ser), get_array(result))
9799

98100

101+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
99102
@pytest.mark.parametrize(
100103
"dtype, new_dtype", [("object", "string"), ("string", "object")]
101104
)
@@ -113,6 +116,7 @@ def test_astype_string_and_object(using_copy_on_write, dtype, new_dtype):
113116
tm.assert_frame_equal(df, df_orig)
114117

115118

119+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
116120
@pytest.mark.parametrize(
117121
"dtype, new_dtype", [("object", "string"), ("string", "object")]
118122
)
@@ -221,6 +225,7 @@ def test_astype_arrow_timestamp(using_copy_on_write):
221225
)
222226

223227

228+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
224229
def test_convert_dtypes_infer_objects(using_copy_on_write):
225230
ser = Series(["a", "b", "c"])
226231
ser_orig = ser.copy()
@@ -240,6 +245,7 @@ def test_convert_dtypes_infer_objects(using_copy_on_write):
240245
tm.assert_series_equal(ser, ser_orig)
241246

242247

248+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
243249
def test_convert_dtypes(using_copy_on_write):
244250
df = DataFrame({"a": ["a", "b"], "b": [1, 2], "c": [1.5, 2.5], "d": [True, False]})
245251
df_orig = df.copy()

pandas/tests/copy_view/test_constructors.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
import pandas as pd
57
from pandas import (
68
DataFrame,
@@ -283,6 +285,7 @@ def test_dataframe_from_dict_of_series_with_reindex(dtype):
283285
assert np.shares_memory(arr_before, arr_after)
284286

285287

288+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)", strict=False)
286289
@pytest.mark.parametrize("cons", [Series, Index])
287290
@pytest.mark.parametrize(
288291
"data, dtype", [([1, 2], None), ([1, 2], "int64"), (["a", "b"], None)]

pandas/tests/copy_view/test_functions.py

+8
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 import (
57
DataFrame,
68
Index,
@@ -12,6 +14,7 @@
1214
from pandas.tests.copy_view.util import get_array
1315

1416

17+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
1518
def test_concat_frames(using_copy_on_write):
1619
df = DataFrame({"b": ["a"] * 3})
1720
df2 = DataFrame({"a": ["a"] * 3})
@@ -36,6 +39,7 @@ def test_concat_frames(using_copy_on_write):
3639
tm.assert_frame_equal(df, df_orig)
3740

3841

42+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
3943
def test_concat_frames_updating_input(using_copy_on_write):
4044
df = DataFrame({"b": ["a"] * 3})
4145
df2 = DataFrame({"a": ["a"] * 3})
@@ -197,6 +201,7 @@ def test_concat_copy_keyword(using_copy_on_write, copy):
197201
assert not np.shares_memory(get_array(df2, "b"), get_array(result, "b"))
198202

199203

204+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
200205
@pytest.mark.parametrize(
201206
"func",
202207
[
@@ -260,6 +265,7 @@ def test_merge_on_index(using_copy_on_write):
260265
tm.assert_frame_equal(df2, df2_orig)
261266

262267

268+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)", strict=False)
263269
@pytest.mark.parametrize(
264270
"func, how",
265271
[
@@ -313,6 +319,7 @@ def test_merge_copy_keyword(using_copy_on_write, copy):
313319
assert not np.shares_memory(get_array(df2, "b"), get_array(result, "b"))
314320

315321

322+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
316323
def test_join_on_key(using_copy_on_write):
317324
df_index = Index(["a", "b", "c"], name="key")
318325

@@ -346,6 +353,7 @@ def test_join_on_key(using_copy_on_write):
346353
tm.assert_frame_equal(df2, df2_orig)
347354

348355

356+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
349357
def test_join_multiple_dataframes_on_key(using_copy_on_write):
350358
df_index = Index(["a", "b", "c"], name="key")
351359

pandas/tests/copy_view/test_internals.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
import pandas.util._test_decorators as td
57

68
import pandas as pd
@@ -76,6 +78,7 @@ def test_switch_options():
7678

7779

7880
@td.skip_array_manager_invalid_test
81+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)", strict=False)
7982
@pytest.mark.parametrize("dtype", [np.intp, np.int8])
8083
@pytest.mark.parametrize(
8184
"locs, arr",

pandas/tests/copy_view/test_interp_fillna.py

+4
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 import (
57
NA,
68
ArrowDtype,
@@ -135,6 +137,7 @@ def test_interp_fill_functions_inplace(
135137
assert np.shares_memory(arr, get_array(df, "a")) is (dtype == "float64")
136138

137139

140+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
138141
def test_interpolate_cleaned_fill_method(using_copy_on_write):
139142
# Check that "method is set to None" case works correctly
140143
df = DataFrame({"a": ["a", np.nan, "c"], "b": 1})
@@ -156,6 +159,7 @@ def test_interpolate_cleaned_fill_method(using_copy_on_write):
156159
tm.assert_frame_equal(df, df_orig)
157160

158161

162+
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
159163
def test_interpolate_object_convert_no_op(using_copy_on_write):
160164
df = DataFrame({"a": ["a", "b", "c"], "b": 1})
161165
arr_a = get_array(df, "a")

0 commit comments

Comments
 (0)