def test_three_pass(self): sigma_thresh = 2 ser = pd.Series([-4, -4] + [0, 1, 2] * 4 + [5]) ser = sigma_edit_series(sigma_thresh, ser, max_iter=3) self.assertTrue(all_in_bounds(sigma_thresh, ser))
def test_nothing_removed(self): sigma_thresh = 10 ser = pd.Series([1, 2, 3, 4, 5]) ser = sigma_edit_series(sigma_thresh, ser, max_iter=1) self.assertEqual(list(ser), [1, 2, 3, 4, 5])
def test_two_pass_exceed_iter(self): sigma_thresh = 2 ser = pd.Series([-4] + [0, 1, 2] * 4 + [5]) with self.assertRaises(ValueError): ser = sigma_edit_series( sigma_thresh, ser, max_iter=1)
def test_empty_series(self): sigma_thresh = 3 ser = pd.Series([]) with self.assertRaises(ValueError): sigma_edit_series(sigma_thresh, ser)
def test_nan_series(self): sigma_thresh = 3 ser = pd.Series([np.NaN for nn in range(10)]) with self.assertRaises(ValueError): sigma_edit_series(sigma_thresh, ser)
def test_two_pass_exceed_iter(self): sigma_thresh = 2 ser = pd.Series([-4] + [0, 1, 2] * 4 + [5]) with self.assertRaises(ValueError): ser = sigma_edit_series(sigma_thresh, ser, max_iter=1)