def test_returns_same_result_as_numpy(percent): sequence = [1.1, 700.5, 2.3, 0.1, 4, 6, 90, 24, 33.45] numpy_result = np.percentile(sequence, percent) result = percentile(sequence, percent) assert result == numpy_result
def test_raises_when_on_empty_input(): with pytest.raises(ValueError): percentile([], 5)
def test_raises_when_percent_is_incorrect(value): with pytest.raises(ValueError): percentile([100], value)