Skip to content

Commit 835c78e

Browse files
[ArrayManager] TST: Convert skip into xfail and clean-up tests that now work (#44571)
1 parent 5b108bc commit 835c78e

19 files changed

+55
-60
lines changed

pandas/tests/frame/indexing/test_setitem.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -728,8 +728,6 @@ def test_setitem_object_array_of_tzaware_datetimes(self, idx, expected):
728728

729729

730730
class TestDataFrameSetItemWithExpansion:
731-
# TODO(ArrayManager) update parent (_maybe_update_cacher)
732-
@td.skip_array_manager_not_yet_implemented
733731
def test_setitem_listlike_views(self):
734732
# GH#38148
735733
df = DataFrame({"a": [1, 2, 3], "b": [4, 4, 6]})

pandas/tests/frame/methods/test_fillna.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,6 @@ def test_fillna_categorical_nan(self):
232232
df = DataFrame({"a": Categorical(idx)})
233233
tm.assert_frame_equal(df.fillna(value=NaT), df)
234234

235-
@td.skip_array_manager_not_yet_implemented # TODO(ArrayManager) implement downcast
236235
def test_fillna_downcast(self):
237236
# GH#15277
238237
# infer int64 from float64
@@ -258,7 +257,6 @@ def test_fillna_dictlike_value_duplicate_colnames(self, columns):
258257
expected["A"] = 0.0
259258
tm.assert_frame_equal(result, expected)
260259

261-
@td.skip_array_manager_not_yet_implemented # TODO(ArrayManager) object upcasting
262260
def test_fillna_dtype_conversion(self):
263261
# make sure that fillna on an empty frame works
264262
df = DataFrame(index=["A", "B", "C"], columns=[1, 2, 3, 4, 5])
@@ -276,7 +274,6 @@ def test_fillna_dtype_conversion(self):
276274
expected = DataFrame("nan", index=range(3), columns=["A", "B"])
277275
tm.assert_frame_equal(result, expected)
278276

279-
@td.skip_array_manager_not_yet_implemented # TODO(ArrayManager) object upcasting
280277
@pytest.mark.parametrize("val", ["", 1, np.nan, 1.0])
281278
def test_fillna_dtype_conversion_equiv_replace(self, val):
282279
df = DataFrame({"A": [1, np.nan], "B": [1.0, 2.0]})

pandas/tests/frame/methods/test_interpolate.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,10 +328,13 @@ def test_interp_string_axis(self, axis_name, axis_number):
328328
expected = df.interpolate(method="linear", axis=axis_number)
329329
tm.assert_frame_equal(result, expected)
330330

331-
@td.skip_array_manager_not_yet_implemented # TODO(ArrayManager) support axis=1
332331
@pytest.mark.parametrize("method", ["ffill", "bfill", "pad"])
333-
def test_interp_fillna_methods(self, axis, method):
332+
def test_interp_fillna_methods(self, request, axis, method, using_array_manager):
334333
# GH 12918
334+
if using_array_manager and (axis == 1 or axis == "columns"):
335+
# TODO(ArrayManager) support axis=1
336+
td.mark_array_manager_not_yet_implemented(request)
337+
335338
df = DataFrame(
336339
{
337340
"A": [1.0, 2.0, 3.0, 4.0, np.nan, 5.0],

pandas/tests/frame/methods/test_rename.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,6 @@ def test_rename_mapper_and_positional_arguments_raises(self):
365365
with pytest.raises(TypeError, match=msg):
366366
df.rename({}, columns={}, index={})
367367

368-
@td.skip_array_manager_not_yet_implemented
369368
def test_rename_with_duplicate_columns(self):
370369
# GH#4403
371370
df4 = DataFrame(

pandas/tests/frame/test_api.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,6 @@ def test_attrs(self):
296296
result = df.rename(columns=str)
297297
assert result.attrs == {"version": 1}
298298

299-
@td.skip_array_manager_not_yet_implemented # TODO(ArrayManager) setitem (no copy)
300299
@pytest.mark.parametrize("allows_duplicate_labels", [True, False, None])
301300
def test_set_flags(self, allows_duplicate_labels, frame_or_series):
302301
obj = DataFrame({"A": [1, 2]})

pandas/tests/frame/test_arithmetic.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -722,11 +722,16 @@ def test_df_add_2d_array_collike_broadcasts(self):
722722
result = collike + df
723723
tm.assert_frame_equal(result, expected)
724724

725-
@td.skip_array_manager_not_yet_implemented # TODO(ArrayManager) decide on dtypes
726-
def test_df_arith_2d_array_rowlike_broadcasts(self, all_arithmetic_operators):
725+
def test_df_arith_2d_array_rowlike_broadcasts(
726+
self, request, all_arithmetic_operators, using_array_manager
727+
):
727728
# GH#23000
728729
opname = all_arithmetic_operators
729730

731+
if using_array_manager and opname in ("__rmod__", "__rfloordiv__"):
732+
# TODO(ArrayManager) decide on dtypes
733+
td.mark_array_manager_not_yet_implemented(request)
734+
730735
arr = np.arange(6).reshape(3, 2)
731736
df = DataFrame(arr, columns=[True, False], index=["A", "B", "C"])
732737

@@ -744,11 +749,16 @@ def test_df_arith_2d_array_rowlike_broadcasts(self, all_arithmetic_operators):
744749
result = getattr(df, opname)(rowlike)
745750
tm.assert_frame_equal(result, expected)
746751

747-
@td.skip_array_manager_not_yet_implemented # TODO(ArrayManager) decide on dtypes
748-
def test_df_arith_2d_array_collike_broadcasts(self, all_arithmetic_operators):
752+
def test_df_arith_2d_array_collike_broadcasts(
753+
self, request, all_arithmetic_operators, using_array_manager
754+
):
749755
# GH#23000
750756
opname = all_arithmetic_operators
751757

758+
if using_array_manager and opname in ("__rmod__", "__rfloordiv__"):
759+
# TODO(ArrayManager) decide on dtypes
760+
td.mark_array_manager_not_yet_implemented(request)
761+
752762
arr = np.arange(6).reshape(3, 2)
753763
df = DataFrame(arr, columns=[True, False], index=["A", "B", "C"])
754764

pandas/tests/frame/test_constructors.py

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2287,16 +2287,18 @@ def test_check_dtype_empty_numeric_column(self, dtype):
22872287

22882288
assert data.b.dtype == dtype
22892289

2290-
# TODO(ArrayManager) astype to bytes dtypes does not yet give object dtype
2291-
@td.skip_array_manager_not_yet_implemented
22922290
@pytest.mark.parametrize(
22932291
"dtype", tm.STRING_DTYPES + tm.BYTES_DTYPES + tm.OBJECT_DTYPES
22942292
)
2295-
def test_check_dtype_empty_string_column(self, dtype):
2293+
def test_check_dtype_empty_string_column(self, request, dtype, using_array_manager):
22962294
# GH24386: Ensure dtypes are set correctly for an empty DataFrame.
22972295
# Empty DataFrame is generated via dictionary data with non-overlapping columns.
22982296
data = DataFrame({"a": [1, 2]}, columns=["b"], dtype=dtype)
22992297

2298+
if using_array_manager and dtype in tm.BYTES_DTYPES:
2299+
# TODO(ArrayManager) astype to bytes dtypes does not yet give object dtype
2300+
td.mark_array_manager_not_yet_implemented(request)
2301+
23002302
assert data.b.dtype.name == "object"
23012303

23022304
def test_to_frame_with_falsey_names(self):
@@ -2466,8 +2468,20 @@ def test_constructor_list_str_na(self, string_dtype):
24662468
tm.assert_frame_equal(result, expected)
24672469

24682470
@pytest.mark.parametrize("copy", [False, True])
2469-
@td.skip_array_manager_not_yet_implemented
2470-
def test_dict_nocopy(self, copy, any_numeric_ea_dtype, any_numpy_dtype):
2471+
def test_dict_nocopy(
2472+
self, request, copy, any_numeric_ea_dtype, any_numpy_dtype, using_array_manager
2473+
):
2474+
if using_array_manager and not (
2475+
(any_numpy_dtype in (tm.STRING_DTYPES + tm.BYTES_DTYPES))
2476+
or (
2477+
any_numpy_dtype
2478+
in (tm.DATETIME64_DTYPES + tm.TIMEDELTA64_DTYPES + tm.BOOL_DTYPES)
2479+
and copy
2480+
)
2481+
):
2482+
# TODO(ArrayManager) properly honor copy keyword for dict input
2483+
td.mark_array_manager_not_yet_implemented(request)
2484+
24712485
a = np.array([1, 2], dtype=any_numpy_dtype)
24722486
b = np.array([3, 4], dtype=any_numpy_dtype)
24732487
if b.dtype.kind in ["S", "U"]:

pandas/tests/frame/test_stack_unstack.py

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

8-
import pandas.util._test_decorators as td
9-
108
import pandas as pd
119
from pandas import (
1210
DataFrame,
@@ -949,7 +947,6 @@ def test_unstack_nan_index4(self):
949947
left = df.loc[17264:].copy().set_index(["s_id", "dosage", "agent"])
950948
tm.assert_frame_equal(left.unstack(), right)
951949

952-
@td.skip_array_manager_not_yet_implemented # TODO(ArrayManager) MultiIndex bug
953950
def test_unstack_nan_index5(self):
954951
# GH9497 - multiple unstack with nulls
955952
df = DataFrame(

pandas/tests/groupby/aggregate/test_other.py

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

11-
import pandas.util._test_decorators as td
12-
1311
import pandas as pd
1412
from pandas import (
1513
DataFrame,
@@ -424,7 +422,6 @@ def __call__(self, x):
424422
tm.assert_frame_equal(result, expected)
425423

426424

427-
@td.skip_array_manager_not_yet_implemented # TODO(ArrayManager) columns with ndarrays
428425
def test_agg_over_numpy_arrays():
429426
# GH 3788
430427
df = DataFrame(

pandas/tests/groupby/test_categorical.py

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

6-
import pandas.util._test_decorators as td
7-
86
import pandas as pd
97
from pandas import (
108
Categorical,
@@ -301,9 +299,7 @@ def test_apply(ordered):
301299
tm.assert_series_equal(result, expected)
302300

303301

304-
# TODO(ArrayManager) incorrect dtype for mean()
305-
@td.skip_array_manager_not_yet_implemented
306-
def test_observed(observed, using_array_manager):
302+
def test_observed(observed):
307303
# multiple groupers, don't re-expand the output space
308304
# of the grouper
309305
# gh-14942 (implement)

0 commit comments

Comments
 (0)