Exemple #1
0
def test_trim_right_fill_value():
    """ Test that fill_value is indeed introduced """
    array = np.arange(0, 101, dtype=float)  # [0, 1, 2, ..., 100]
    trimmed = trimr(array, percentile=20, fill_value=np.nan)
    assert np.any(np.isnan(trimmed))
Exemple #2
0
def test_trim_right_trimming():
    """ Test that trimming is working """
    array = np.arange(0, 101)  # [0, 1, 2, ..., 100]
    trimmed = trimr(array, percentile=20, fill_value=0)
    assert np.all(trimmed <= 20)
Exemple #3
0
 def test_trimming(self):
     """ Test that trimming is working """
     array = np.arange(0, 101)  # [0, 1, 2, ..., 100]
     trimmed = trimr(array, percentile=20, fill_value=0)
     self.assertTrue(np.all(trimmed <= 20))
Exemple #4
0
def test_trim_right_trivial():
    """ Test that nothing is trimmed when percentile is 100 """
    array = np.arange(0, 101)
    trimmed = trimr(array, percentile=100)
    assert np.allclose(array, trimmed)
Exemple #5
0
 def test_trivial(self):
     """ Test that nothing is trimmed when percentile is 100 """
     array = np.arange(0, 101)
     trimmed = trimr(array, percentile=100)
     self.assertTrue(np.allclose(array, trimmed))