Testing Class Material

This commit is contained in:
Lisa Schwetlick 2024-08-26 13:54:13 +02:00
commit 05b1f6cdd5
85 changed files with 102796 additions and 0 deletions

View file

@ -0,0 +1,10 @@
def find_maxima(x):
"""Find local maxima of x.
Input arguments:
x -- 1D list of real numbers
Output:
idx -- list of indices of the local maxima in x
"""
return []

View file

@ -0,0 +1,30 @@
from local_maxima import find_maxima
def test_find_maxima():
values = [1, 3, -2, 0, 2, 1]
expected = [1, 4]
maxima = find_maxima(values)
assert maxima == expected
def test_find_maxima_edges():
values = [4, 2, 1, 3, 1, 5]
expected = [0, 3, 5]
maxima = find_maxima(values)
assert maxima == expected
def test_find_maxima_empty():
values = []
expected = []
maxima = find_maxima(values)
assert maxima == expected
def test_find_maxima_plateau():
raise Exception('not yet implemented')
def test_find_maxima_not_a_plateau():
raise Exception('not yet implemented')