From cc0135a9663939c50fae12727a828184173a6f3b Mon Sep 17 00:00:00 2001 From: jbrockmendel Date: Tue, 24 Dec 2019 10:12:19 -0800 Subject: [PATCH] CLN: remove unnecessary scipy attr checks --- pandas/tests/frame/test_missing.py | 11 ----------- pandas/tests/series/test_missing.py | 24 ++---------------------- 2 files changed, 2 insertions(+), 33 deletions(-) diff --git a/pandas/tests/frame/test_missing.py b/pandas/tests/frame/test_missing.py index 0b77c0067e5f2..ea7e9b4ac490d 100644 --- a/pandas/tests/frame/test_missing.py +++ b/pandas/tests/frame/test_missing.py @@ -12,15 +12,6 @@ import pandas.util.testing as tm -def _skip_if_no_pchip(): - try: - from scipy.interpolate import pchip_interpolate # noqa - except ImportError: - import pytest - - pytest.skip("scipy.interpolate.pchip missing") - - class TestDataFrameMissingData: def test_dropEmptyRows(self, float_frame): N = len(float_frame.index) @@ -837,8 +828,6 @@ def test_interp_alt_scipy(self): expectedk["A"] = expected["A"] tm.assert_frame_equal(result, expectedk) - _skip_if_no_pchip() - result = df.interpolate(method="pchip") expected.loc[2, "A"] = 3 expected.loc[5, "A"] = 6.0 diff --git a/pandas/tests/series/test_missing.py b/pandas/tests/series/test_missing.py index 8e1fee4d542e7..45159cc28c5b7 100644 --- a/pandas/tests/series/test_missing.py +++ b/pandas/tests/series/test_missing.py @@ -24,24 +24,6 @@ import pandas.util.testing as tm -def _skip_if_no_pchip(): - try: - from scipy.interpolate import pchip_interpolate # noqa - except ImportError: - import pytest - - pytest.skip("scipy.interpolate.pchip missing") - - -def _skip_if_no_akima(): - try: - from scipy.interpolate import Akima1DInterpolator # noqa - except ImportError: - import pytest - - pytest.skip("scipy.interpolate.Akima1DInterpolator missing") - - def _simple_ts(start, end, freq="D"): rng = date_range(start, end, freq=freq) return Series(np.random.randn(len(rng)), index=rng) @@ -1099,7 +1081,6 @@ def test_interpolate_time_raises_for_non_timeseries(self): @td.skip_if_no_scipy def test_interpolate_pchip(self): - _skip_if_no_pchip() ser = Series(np.sort(np.random.uniform(size=100))) @@ -1113,7 +1094,6 @@ def test_interpolate_pchip(self): @td.skip_if_no_scipy def test_interpolate_akima(self): - _skip_if_no_akima() ser = Series([10, 11, 12, 13]) @@ -1619,7 +1599,7 @@ def test_interp_non_timedelta_index(self, interp_methods_ind, ind): method, kwargs = interp_methods_ind if method == "pchip": - _skip_if_no_pchip() + pytest.importorskip("scipy") if method == "linear": result = df[0].interpolate(**kwargs) @@ -1647,7 +1627,7 @@ def test_interpolate_timedelta_index(self, interp_methods_ind): method, kwargs = interp_methods_ind if method == "pchip": - _skip_if_no_pchip() + pytest.importorskip("scipy") if method in {"linear", "pchip"}: result = df[0].interpolate(method=method, **kwargs)