Skip to content

TST: strictly xfail #38901

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jan 3, 2021
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pandas/tests/extension/test_categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,9 @@ class TestConstructors(base.BaseConstructorsTests):


class TestReshaping(base.BaseReshapingTests):
@pytest.mark.xfail(reason="Deliberately upcast to object?")
def test_concat_with_reindex(self, data):
pytest.xfail(reason="Deliberately upcast to object?")
super().test_concat_with_reindex(data)


class TestGetitem(base.BaseGetitemTests):
Expand Down
10 changes: 6 additions & 4 deletions pandas/tests/frame/test_reductions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1229,13 +1229,15 @@ def test_min_max_dt64_with_NaT(self):
exp = Series([pd.NaT], index=["foo"])
tm.assert_series_equal(res, exp)

def test_min_max_dt64_with_NaT_skipna_false(self, tz_naive_fixture):
def test_min_max_dt64_with_NaT_skipna_false(self, request, tz_naive_fixture):
# GH#36907
tz = tz_naive_fixture
if isinstance(tz, tzlocal) and is_platform_windows():
pytest.xfail(
reason="GH#37659 OSError raised within tzlocal bc Windows "
"chokes in times before 1970-01-01"
request.node.add_marker(
pytest.mark.xfail(
reason="GH#37659 OSError raised within tzlocal bc Windows "
"chokes in times before 1970-01-01"
)
)

df = DataFrame(
Expand Down
24 changes: 18 additions & 6 deletions pandas/tests/frame/test_ufunc.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,14 @@ def test_unary_unary(dtype):


@pytest.mark.parametrize("dtype", dtypes)
def test_unary_binary(dtype):
def test_unary_binary(request, dtype):
# unary input, binary output
if pd.api.types.is_extension_array_dtype(dtype) or isinstance(dtype, dict):
pytest.xfail(reason="Extension / mixed with multiple outuputs not implemented.")
request.node.add_marker(
pytest.mark.xfail(
reason="Extension / mixed with multiple outputs not implemented."
)
)

values = np.array([[-1, -1], [1, 1]], dtype="int64")
df = pd.DataFrame(values, columns=["A", "B"], index=["a", "b"]).astype(dtype=dtype)
Expand Down Expand Up @@ -55,14 +59,18 @@ def test_binary_input_dispatch_binop(dtype):

@pytest.mark.parametrize("dtype_a", dtypes)
@pytest.mark.parametrize("dtype_b", dtypes)
def test_binary_input_aligns_columns(dtype_a, dtype_b):
def test_binary_input_aligns_columns(request, dtype_a, dtype_b):
if (
pd.api.types.is_extension_array_dtype(dtype_a)
or isinstance(dtype_a, dict)
or pd.api.types.is_extension_array_dtype(dtype_b)
or isinstance(dtype_b, dict)
):
pytest.xfail(reason="Extension / mixed with multiple inputs not implemented.")
request.node.add_marker(
pytest.mark.xfail(
reason="Extension / mixed with multiple inputs not implemented."
)
)

df1 = pd.DataFrame({"A": [1, 2], "B": [3, 4]}).astype(dtype_a)

Expand All @@ -80,9 +88,13 @@ def test_binary_input_aligns_columns(dtype_a, dtype_b):


@pytest.mark.parametrize("dtype", dtypes)
def test_binary_input_aligns_index(dtype):
def test_binary_input_aligns_index(request, dtype):
if pd.api.types.is_extension_array_dtype(dtype) or isinstance(dtype, dict):
pytest.xfail(reason="Extension / mixed with multiple inputs not implemented.")
request.node.add_marker(
pytest.mark.xfail(
reason="Extension / mixed with multiple inputs not implemented."
)
)
df1 = pd.DataFrame({"A": [1, 2], "B": [3, 4]}, index=["a", "b"]).astype(dtype)
df2 = pd.DataFrame({"A": [1, 2], "B": [3, 4]}, index=["a", "c"]).astype(dtype)
result = np.heaviside(df1, df2)
Expand Down
4 changes: 2 additions & 2 deletions pandas/tests/generic/test_finalize.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,14 +547,14 @@ def test_finalize_called_eval_numexpr():
(pd.DataFrame({"A": [1]}), pd.Series([1])),
],
)
def test_binops(args, annotate, all_arithmetic_functions):
def test_binops(request, args, annotate, all_arithmetic_functions):
# This generates 326 tests... Is that needed?
left, right = args
if annotate == "both" and isinstance(left, int) or isinstance(right, int):
return

if isinstance(left, pd.DataFrame) or isinstance(right, pd.DataFrame):
pytest.xfail(reason="not implemented")
request.node.add_marker(pytest.mark.xfail(reason="not implemented"))

if annotate in {"left", "both"} and not isinstance(left, int):
left.attrs = {"a": 1}
Expand Down
24 changes: 15 additions & 9 deletions pandas/tests/groupby/transform/test_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,10 @@ def test_transform_broadcast(tsframe, ts):
assert_fp_equal(res.xs(idx), agged[idx])


def test_transform_axis_1(transformation_func):
def test_transform_axis_1(request, transformation_func):
# GH 36308
if transformation_func == "tshift":
pytest.xfail("tshift is deprecated")
request.node.add_marker(pytest.mark.xfail(reason="tshift is deprecated"))
args = ("ffill",) if transformation_func == "fillna" else ()

df = DataFrame({"a": [1, 2], "b": [3, 4], "c": [5, 6]}, index=["x", "y"])
Expand Down Expand Up @@ -333,7 +333,7 @@ def test_dispatch_transform(tsframe):
tm.assert_frame_equal(filled, expected)


def test_transform_transformation_func(transformation_func):
def test_transform_transformation_func(request, transformation_func):
# GH 30918
df = DataFrame(
{
Expand All @@ -354,7 +354,7 @@ def test_transform_transformation_func(transformation_func):
"Current behavior of groupby.tshift is inconsistent with other "
"transformations. See GH34452 for more details"
)
pytest.xfail(msg)
request.node.add_marker(pytest.mark.xfail(reason=msg))
else:
test_op = lambda x: x.transform(transformation_func)
mock_op = lambda x: getattr(x, transformation_func)()
Expand Down Expand Up @@ -1038,16 +1038,22 @@ def test_transform_invalid_name_raises():
Series([0, 0, 0, 1, 1, 1], index=["A", "B", "C", "D", "E", "F"]),
],
)
def test_transform_agg_by_name(reduction_func, obj):
def test_transform_agg_by_name(request, reduction_func, obj):
func = reduction_func
g = obj.groupby(np.repeat([0, 1], 3))

if func == "ngroup": # GH#27468
pytest.xfail("TODO: g.transform('ngroup') doesn't work")
if func == "size": # GH#27469
pytest.xfail("TODO: g.transform('size') doesn't work")
request.node.add_marker(
pytest.mark.xfail(reason="TODO: g.transform('ngroup') doesn't work")
)
if func == "size" and obj.ndim == 2: # GH#27469
request.node.add_marker(
pytest.mark.xfail(reason="TODO: g.transform('size') doesn't work")
)
if func == "corrwith" and isinstance(obj, Series): # GH#32293
pytest.xfail("TODO: implement SeriesGroupBy.corrwith")
request.node.add_marker(
pytest.mark.xfail(reason="TODO: implement SeriesGroupBy.corrwith")
)

args = {"nth": [0], "quantile": [0.5], "corrwith": [obj]}.get(func, [])

Expand Down
6 changes: 4 additions & 2 deletions pandas/tests/indexes/datetimes/test_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,12 @@ def test_repeat(self, tz_naive_fixture):
("U", "microsecond"),
],
)
def test_resolution(self, tz_naive_fixture, freq, expected):
def test_resolution(self, request, tz_naive_fixture, freq, expected):
tz = tz_naive_fixture
if freq == "A" and not IS64 and isinstance(tz, tzlocal):
pytest.xfail(reason="OverflowError inside tzlocal past 2038")
request.node.add_marker(
pytest.mark.xfail(reason="OverflowError inside tzlocal past 2038")
)

idx = date_range(start="2013-04-01", periods=30, freq=freq, tz=tz)
assert idx.resolution == expected
Expand Down
6 changes: 4 additions & 2 deletions pandas/tests/indexes/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1596,13 +1596,15 @@ def test_isin_nan_common_object(self, nulls_fixture, nulls_fixture2):
np.array([False, False]),
)

def test_isin_nan_common_float64(self, nulls_fixture):
def test_isin_nan_common_float64(self, request, nulls_fixture):
if nulls_fixture is pd.NaT:
pytest.skip("pd.NaT not compatible with Float64Index")

# Float64Index overrides isin, so must be checked separately
if nulls_fixture is pd.NA:
pytest.xfail("Float64Index cannot contain pd.NA")
request.node.add_marker(
pytest.mark.xfail(reason="Float64Index cannot contain pd.NA")
)

tm.assert_numpy_array_equal(
Float64Index([1.0, nulls_fixture]).isin([np.nan]), np.array([False, True])
Expand Down
8 changes: 5 additions & 3 deletions pandas/tests/indexes/test_setops.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,21 @@ def test_union_same_types(index):
assert idx1.union(idx2).dtype == idx1.dtype


def test_union_different_types(index, index_fixture2):
def test_union_different_types(request, index, index_fixture2):
# This test only considers combinations of indices
# GH 23525
idx1, idx2 = index, index_fixture2
type_pair = tuple(sorted([type(idx1), type(idx2)], key=lambda x: str(x)))
if type_pair in COMPATIBLE_INCONSISTENT_PAIRS:
pytest.xfail("This test only considers non compatible indexes.")
request.node.add_marker(
pytest.mark.xfail(reason="This test only considers non compatible indexes.")
)

if any(isinstance(idx, pd.MultiIndex) for idx in (idx1, idx2)):
pytest.xfail("This test doesn't consider multiindixes.")

if is_dtype_equal(idx1.dtype, idx2.dtype):
pytest.xfail("This test only considers non matching dtypes.")
pytest.skip("This test only considers non matching dtypes.")

# A union with a CategoricalIndex (even as dtype('O')) and a
# non-CategoricalIndex can only be made if both indices are monotonic.
Expand Down
69 changes: 46 additions & 23 deletions pandas/tests/indexing/test_coercion.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,26 +339,33 @@ def test_setitem_index_float64(self, val, exp_dtype, request):
exp_index = pd.Index([1.1, 2.1, 3.1, 4.1, val])
self._assert_setitem_index_conversion(obj, val, exp_index, exp_dtype)

@pytest.mark.xfail(reason="Test not implemented")
def test_setitem_series_period(self):
pytest.xfail("Test not implemented")
raise NotImplementedError

@pytest.mark.xfail(reason="Test not implemented")
def test_setitem_index_complex128(self):
pytest.xfail("Test not implemented")
raise NotImplementedError

@pytest.mark.xfail(reason="Test not implemented")
def test_setitem_index_bool(self):
pytest.xfail("Test not implemented")
raise NotImplementedError

@pytest.mark.xfail(reason="Test not implemented")
def test_setitem_index_datetime64(self):
pytest.xfail("Test not implemented")
raise NotImplementedError

@pytest.mark.xfail(reason="Test not implemented")
def test_setitem_index_datetime64tz(self):
pytest.xfail("Test not implemented")
raise NotImplementedError

@pytest.mark.xfail(reason="Test not implemented")
def test_setitem_index_timedelta64(self):
pytest.xfail("Test not implemented")
raise NotImplementedError

@pytest.mark.xfail(reason="Test not implemented")
def test_setitem_index_period(self):
pytest.xfail("Test not implemented")
raise NotImplementedError


class TestInsertIndexCoercion(CoercionBase):
Expand Down Expand Up @@ -511,11 +518,13 @@ def test_insert_index_period(self, insert, coerced_val, coerced_dtype):
# passing keywords to pd.Index
pd.Index(data, freq="M")

@pytest.mark.xfail(reason="Test not implemented")
def test_insert_index_complex128(self):
pytest.xfail("Test not implemented")
raise NotImplementedError

@pytest.mark.xfail(reason="Test not implemented")
def test_insert_index_bool(self):
pytest.xfail("Test not implemented")
raise NotImplementedError


class TestWhereCoercion(CoercionBase):
Expand Down Expand Up @@ -760,17 +769,21 @@ def test_where_index_datetime64tz(self):

self._assert_where_conversion(obj, cond, values, exp, exp_dtype)

@pytest.mark.xfail(reason="Test not implemented")
def test_where_index_complex128(self):
pytest.xfail("Test not implemented")
raise NotImplementedError

@pytest.mark.xfail(reason="Test not implemented")
def test_where_index_bool(self):
pytest.xfail("Test not implemented")
raise NotImplementedError

@pytest.mark.xfail(reason="Test not implemented")
def test_where_series_timedelta64(self):
pytest.xfail("Test not implemented")
raise NotImplementedError

@pytest.mark.xfail(reason="Test not implemented")
def test_where_series_period(self):
pytest.xfail("Test not implemented")
raise NotImplementedError

@pytest.mark.parametrize(
"value", [pd.Timedelta(days=9), timedelta(days=9), np.timedelta64(9, "D")]
Expand Down Expand Up @@ -822,8 +835,9 @@ class TestFillnaSeriesCoercion(CoercionBase):

method = "fillna"

@pytest.mark.xfail(reason="Test not implemented")
def test_has_comprehensive_tests(self):
pytest.xfail("Test not implemented")
raise NotImplementedError

def _assert_fillna_conversion(self, original, value, expected, expected_dtype):
""" test coercion triggered by fillna """
Expand Down Expand Up @@ -942,29 +956,37 @@ def test_fillna_datetime64tz(self, index_or_series, fill_val, fill_dtype):
)
self._assert_fillna_conversion(obj, fill_val, exp, fill_dtype)

@pytest.mark.xfail(reason="Test not implemented")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should just parameterize these (followon)

def test_fillna_series_int64(self):
pytest.xfail("Test not implemented")
raise NotImplementedError

@pytest.mark.xfail(reason="Test not implemented")
def test_fillna_index_int64(self):
pytest.xfail("Test not implemented")
raise NotImplementedError

@pytest.mark.xfail(reason="Test not implemented")
def test_fillna_series_bool(self):
pytest.xfail("Test not implemented")
raise NotImplementedError

@pytest.mark.xfail(reason="Test not implemented")
def test_fillna_index_bool(self):
pytest.xfail("Test not implemented")
raise NotImplementedError

@pytest.mark.xfail(reason="Test not implemented")
def test_fillna_series_timedelta64(self):
pytest.xfail("Test not implemented")
raise NotImplementedError

@pytest.mark.xfail(reason="Test not implemented")
def test_fillna_series_period(self):
pytest.xfail("Test not implemented")
raise NotImplementedError

@pytest.mark.xfail(reason="Test not implemented")
def test_fillna_index_timedelta64(self):
pytest.xfail("Test not implemented")
raise NotImplementedError

@pytest.mark.xfail(reason="Test not implemented")
def test_fillna_index_period(self):
pytest.xfail("Test not implemented")
raise NotImplementedError


class TestReplaceSeriesCoercion(CoercionBase):
Expand Down Expand Up @@ -1120,5 +1142,6 @@ def test_replace_series_datetime_datetime(self, how, to_key, from_key):

tm.assert_series_equal(result, exp)

@pytest.mark.xfail(reason="Test not implemented")
def test_replace_series_period(self):
pytest.xfail("Test not implemented")
raise NotImplementedError
Loading