예제 #1
0
def test_avg_returns_zero_after_filterd_list_is_empty():
    c = Calc()

    res = c.avg([1, 2, 3], lower=2, upper=3)

    assert res == 0
예제 #2
0
def test_avg_correct_average():
    c = Calc()

    res = c.avg([2, 5, 12, 98])

    assert res == 29.25
예제 #3
0
def test_avg_returns_zero_for_empty_list():
    c = Calc()

    res = c.avg([])

    assert res == 0
예제 #4
0
def test_avg_removes_with_both_bounds():
    c = Calc()

    res = c.avg([2, 3, 3, 4, 5], lower=2, upper=5)

    assert res == pytest.approx(3.333333)
예제 #5
0
def test_avg_removes_lower_outlier_at_border():
    c = Calc()

    res = c.avg([2, 3, 3, 4], lower=2)

    assert res == pytest.approx(3.333333)
예제 #6
0
def test_avg_removes_upper_outlier_at_border():
    c = Calc()

    res = c.avg([3, 3, 4, 5], upper=5)

    assert res == pytest.approx(3.333333)
예제 #7
0
def test_avg_removes_upper_outliers():
    c = Calc()

    res = c.avg([3, 3, 4, 98, 101], upper=10)

    assert res == pytest.approx(3.333333)