Skip to content

Commit e01936d

Browse files
committed
de-duplicate
1 parent 2a2d0af commit e01936d

File tree

1 file changed

+13
-36
lines changed

1 file changed

+13
-36
lines changed

pandas/tests/frame/test_analytics.py

+13-36
Original file line numberDiff line numberDiff line change
@@ -786,6 +786,19 @@ def kurt(x):
786786
except ImportError:
787787
pass
788788

789+
# TODO: Ensure warning isn't emitted in the first place
790+
@pytest.mark.filterwarnings("ignore:All-NaN:RuntimeWarning")
791+
def test_median(self, float_frame_with_na, int_frame):
792+
def wrapper(x):
793+
if isna(x).any():
794+
return np.nan
795+
return np.median(x)
796+
797+
assert_stat_op_calc('median', wrapper, float_frame_with_na,
798+
check_dates=True)
799+
assert_stat_op_calc('median', wrapper, int_frame, check_dtype=False,
800+
check_dates=True)
801+
789802
@pytest.mark.parametrize('method', ['sum', 'mean', 'prod', 'var',
790803
'std', 'skew', 'min', 'max'])
791804
def test_stat_operators_attempt_obj_array(self, method):
@@ -868,42 +881,6 @@ def test_mean_excludeds_datetimes(self, tz):
868881
expected = pd.Series()
869882
tm.assert_series_equal(result, expected)
870883

871-
# TODO: Ensure warning isn't emitted in the first place
872-
@pytest.mark.filterwarnings("ignore:All-NaN:RuntimeWarning")
873-
def test_median(self, float_frame_with_na):
874-
def wrapper(x):
875-
if isna(x).any():
876-
return np.nan
877-
return np.median(x)
878-
879-
assert_stat_op_calc('median', wrapper, float_frame_with_na,
880-
check_dates=True)
881-
882-
# TODO: Ensure warning isn't emitted in the first place
883-
@pytest.mark.filterwarnings("ignore:All-NaN:RuntimeWarning")
884-
def test_median_corner(self, int_frame):
885-
def wrapper(x):
886-
if isna(x).any():
887-
return np.nan
888-
return np.median(x)
889-
890-
assert_stat_op_calc('median', wrapper, int_frame, check_dtype=False,
891-
check_dates=True)
892-
893-
def test_min(self, float_frame_with_na, int_frame):
894-
with warnings.catch_warnings(record=True):
895-
warnings.simplefilter("ignore", RuntimeWarning)
896-
assert_stat_op_calc('min', np.min, float_frame_with_na,
897-
check_dates=True)
898-
assert_stat_op_calc('min', np.min, int_frame)
899-
900-
def test_max(self, float_frame_with_na, int_frame):
901-
with warnings.catch_warnings(record=True):
902-
warnings.simplefilter("ignore", RuntimeWarning)
903-
assert_stat_op_calc('max', np.max, float_frame_with_na,
904-
check_dates=True)
905-
assert_stat_op_calc('max', np.max, int_frame)
906-
907884
def test_var_std(self, datetime_frame):
908885
result = datetime_frame.std(ddof=4)
909886
expected = datetime_frame.apply(lambda x: x.std(ddof=4))

0 commit comments

Comments
 (0)