def test_average_non_iterable(): with pytest.raises(TypeError): calc.avg(123)
def test_average_empty_iterable(): with pytest.raises(ZeroDivisionError): calc.avg([])
def test_average_zero_limit(): assert calc.avg([-1, 0, 1], lower_bound=0) == 0.5
def test_average_outliers(): assert calc.avg([2, 5, 12, 98], lower_bound=0, upper_bound=50) == pytest.approx(6.333, rel=0.01)
def test_average_range(): assert calc.avg(range(19)) == 9
def test_average_list(): assert calc.avg([2, 5, 12, 98]) == 29.25