From a664ff5b4212fe6038efc04925e1853bf4f68c4d Mon Sep 17 00:00:00 2001 From: Matt Roeschke Date: Mon, 20 Apr 2020 11:03:33 -0700 Subject: [PATCH 1/4] Remove some xfails --- .../tests/arrays/sparse/test_arithmetics.py | 5 ----- pandas/tests/groupby/test_function.py | 20 ------------------- .../tests/groupby/transform/test_transform.py | 2 -- pandas/tests/io/test_pickle.py | 1 - pandas/tests/scalar/period/test_period.py | 5 ----- .../tests/scalar/timedelta/test_arithmetic.py | 14 +------------ 6 files changed, 1 insertion(+), 46 deletions(-) diff --git a/pandas/tests/arrays/sparse/test_arithmetics.py b/pandas/tests/arrays/sparse/test_arithmetics.py index bf7d275e4ff7b..4ae1c1e6b63ce 100644 --- a/pandas/tests/arrays/sparse/test_arithmetics.py +++ b/pandas/tests/arrays/sparse/test_arithmetics.py @@ -31,11 +31,6 @@ def _assert(self, a, b): def _check_numeric_ops(self, a, b, a_dense, b_dense, mix, op): with np.errstate(invalid="ignore", divide="ignore"): - if op in [operator.floordiv, ops.rfloordiv]: - # FIXME: GH#13843 - if self._base == pd.Series and a.dtype.subtype == np.dtype("int64"): - pytest.xfail("Not defined/working. See GH#13843") - if mix: result = op(a, b_dense).to_dense() else: diff --git a/pandas/tests/groupby/test_function.py b/pandas/tests/groupby/test_function.py index 346de55f551df..01a8e920f2163 100644 --- a/pandas/tests/groupby/test_function.py +++ b/pandas/tests/groupby/test_function.py @@ -698,11 +698,6 @@ def test_numpy_compat(func): getattr(g, func)(foo=1) -@pytest.mark.xfail( - _is_numpy_dev, - reason="https://github.com/pandas-dev/pandas/issues/31992", - strict=False, -) def test_cummin(numpy_dtypes_for_minmax): dtype = numpy_dtypes_for_minmax[0] min_val = numpy_dtypes_for_minmax[1] @@ -751,11 +746,6 @@ def test_cummin(numpy_dtypes_for_minmax): tm.assert_series_equal(result, expected) -@pytest.mark.xfail( - _is_numpy_dev, - reason="https://github.com/pandas-dev/pandas/issues/31992", - strict=False, -) def test_cummin_all_nan_column(): base_df = pd.DataFrame({"A": [1, 1, 1, 1, 2, 2, 2, 2], "B": [np.nan] * 8}) @@ -766,11 +756,6 @@ def test_cummin_all_nan_column(): tm.assert_frame_equal(expected, result) -@pytest.mark.xfail( - _is_numpy_dev, - reason="https://github.com/pandas-dev/pandas/issues/31992", - strict=False, -) def test_cummax(numpy_dtypes_for_minmax): dtype = numpy_dtypes_for_minmax[0] max_val = numpy_dtypes_for_minmax[2] @@ -819,11 +804,6 @@ def test_cummax(numpy_dtypes_for_minmax): tm.assert_series_equal(result, expected) -@pytest.mark.xfail( - _is_numpy_dev, - reason="https://github.com/pandas-dev/pandas/issues/31992", - strict=False, -) def test_cummax_all_nan_column(): base_df = pd.DataFrame({"A": [1, 1, 1, 1, 2, 2, 2, 2], "B": [np.nan] * 8}) diff --git a/pandas/tests/groupby/transform/test_transform.py b/pandas/tests/groupby/transform/test_transform.py index 2295eb2297fa6..3fcf4f0c69a3d 100644 --- a/pandas/tests/groupby/transform/test_transform.py +++ b/pandas/tests/groupby/transform/test_transform.py @@ -330,8 +330,6 @@ def test_transform_transformation_func(transformation_func): if transformation_func in ["pad", "backfill", "tshift", "cumcount"]: # These transformation functions are not yet covered in this test pytest.xfail("See GH 31269") - elif _is_numpy_dev and transformation_func in ["cummin"]: - pytest.xfail("https://github.com/pandas-dev/pandas/issues/31992") elif transformation_func == "fillna": test_op = lambda x: x.transform("fillna", value=0) mock_op = lambda x: x.fillna(value=0) diff --git a/pandas/tests/io/test_pickle.py b/pandas/tests/io/test_pickle.py index 584a545769c4c..42b4ea5ad9aac 100644 --- a/pandas/tests/io/test_pickle.py +++ b/pandas/tests/io/test_pickle.py @@ -196,7 +196,6 @@ def test_pickle_path_localpath(): tm.assert_frame_equal(df, result) -@pytest.mark.xfail(reason="GitHub issue #31310", strict=False) def test_legacy_sparse_warning(datapath): """ diff --git a/pandas/tests/scalar/period/test_period.py b/pandas/tests/scalar/period/test_period.py index 304033f82c7a2..ea0bb9d3255e0 100644 --- a/pandas/tests/scalar/period/test_period.py +++ b/pandas/tests/scalar/period/test_period.py @@ -1437,11 +1437,6 @@ def test_period_immutable(): per.freq = 2 * freq -@pytest.mark.xfail( - StrictVersion(dateutil.__version__.split(".dev")[0]) < StrictVersion("2.7.0"), - reason="Bug in dateutil < 2.7.0 when parsing old dates: Period('0001-01-07', 'D')", - strict=False, -) def test_small_year_parsing(): per1 = Period("0001-01-07", "D") assert per1.year == 1 diff --git a/pandas/tests/scalar/timedelta/test_arithmetic.py b/pandas/tests/scalar/timedelta/test_arithmetic.py index 7baeb8f5673bc..f1b34c0d26aa2 100644 --- a/pandas/tests/scalar/timedelta/test_arithmetic.py +++ b/pandas/tests/scalar/timedelta/test_arithmetic.py @@ -410,19 +410,7 @@ def test_td_div_numeric_scalar(self): assert result == Timedelta(days=2) @pytest.mark.parametrize( - "nan", - [ - np.nan, - pytest.param( - np.float64("NaN"), - marks=pytest.mark.xfail( - _is_numpy_dev, - reason="https://github.com/pandas-dev/pandas/issues/31992", - strict=False, - ), - ), - float("nan"), - ], + "nan", [np.nan, np.float64("NaN"), float("nan"),], ) def test_td_div_nan(self, nan): # np.float64('NaN') has a 'dtype' attr, avoid treating as array From e13c7fb32e579ffaa83cb1b212d71c8e79050c4f Mon Sep 17 00:00:00 2001 From: Matt Roeschke Date: Mon, 20 Apr 2020 11:06:16 -0700 Subject: [PATCH 2/4] Remove comma --- pandas/tests/scalar/timedelta/test_arithmetic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tests/scalar/timedelta/test_arithmetic.py b/pandas/tests/scalar/timedelta/test_arithmetic.py index f1b34c0d26aa2..ec79797e80cf9 100644 --- a/pandas/tests/scalar/timedelta/test_arithmetic.py +++ b/pandas/tests/scalar/timedelta/test_arithmetic.py @@ -410,7 +410,7 @@ def test_td_div_numeric_scalar(self): assert result == Timedelta(days=2) @pytest.mark.parametrize( - "nan", [np.nan, np.float64("NaN"), float("nan"),], + "nan", [np.nan, np.float64("NaN"), float("nan")], ) def test_td_div_nan(self, nan): # np.float64('NaN') has a 'dtype' attr, avoid treating as array From 7dd86a3183bf4ffb1d662984d20318c0d7f74732 Mon Sep 17 00:00:00 2001 From: Matt Roeschke Date: Mon, 20 Apr 2020 11:49:31 -0700 Subject: [PATCH 3/4] Add back one xfail --- pandas/tests/scalar/timedelta/test_arithmetic.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/pandas/tests/scalar/timedelta/test_arithmetic.py b/pandas/tests/scalar/timedelta/test_arithmetic.py index ec79797e80cf9..eb22b715f9f4d 100644 --- a/pandas/tests/scalar/timedelta/test_arithmetic.py +++ b/pandas/tests/scalar/timedelta/test_arithmetic.py @@ -410,7 +410,20 @@ def test_td_div_numeric_scalar(self): assert result == Timedelta(days=2) @pytest.mark.parametrize( - "nan", [np.nan, np.float64("NaN"), float("nan")], + "nan", + [ + np.nan, + pytest.param( + np.float64("NaN"), + marks=pytest.mark.xfail( + _is_numpy_dev, + raises=RuntimeWarning, + reason="https://github.com/pandas-dev/pandas/issues/31992", + strict=False, + ), + ), + float("nan"), + ], ) def test_td_div_nan(self, nan): # np.float64('NaN') has a 'dtype' attr, avoid treating as array From 1d29aa9e432c2f2a5155e7878981edbf8acbbd81 Mon Sep 17 00:00:00 2001 From: Matt Roeschke Date: Mon, 20 Apr 2020 11:51:47 -0700 Subject: [PATCH 4/4] remove unused imports --- pandas/tests/groupby/test_function.py | 1 - pandas/tests/groupby/transform/test_transform.py | 1 - pandas/tests/scalar/period/test_period.py | 2 -- 3 files changed, 4 deletions(-) diff --git a/pandas/tests/groupby/test_function.py b/pandas/tests/groupby/test_function.py index 01a8e920f2163..93dd1bf23c308 100644 --- a/pandas/tests/groupby/test_function.py +++ b/pandas/tests/groupby/test_function.py @@ -16,7 +16,6 @@ NaT, Series, Timestamp, - _is_numpy_dev, date_range, isna, ) diff --git a/pandas/tests/groupby/transform/test_transform.py b/pandas/tests/groupby/transform/test_transform.py index 3fcf4f0c69a3d..e1042bf35acc4 100644 --- a/pandas/tests/groupby/transform/test_transform.py +++ b/pandas/tests/groupby/transform/test_transform.py @@ -15,7 +15,6 @@ MultiIndex, Series, Timestamp, - _is_numpy_dev, concat, date_range, ) diff --git a/pandas/tests/scalar/period/test_period.py b/pandas/tests/scalar/period/test_period.py index ea0bb9d3255e0..620fc1c006d93 100644 --- a/pandas/tests/scalar/period/test_period.py +++ b/pandas/tests/scalar/period/test_period.py @@ -1,7 +1,5 @@ from datetime import date, datetime, timedelta -from distutils.version import StrictVersion -import dateutil import numpy as np import pytest import pytz