initial commit with 2024 materials
This commit is contained in:
commit
6fdfdbb8b7
66 changed files with 102457 additions and 0 deletions
36
hands_on_solutions/local_maxima/test_local_maxima.py
Normal file
36
hands_on_solutions/local_maxima/test_local_maxima.py
Normal file
|
@ -0,0 +1,36 @@
|
|||
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():
|
||||
values = [1, 2, 2, 1]
|
||||
expected = [1]
|
||||
maxima = find_maxima(values)
|
||||
assert maxima == expected
|
||||
|
||||
|
||||
def test_find_maxima_not_a_plateau():
|
||||
values = [1, 2, 2, 3, 1]
|
||||
expected = [3]
|
||||
maxima = find_maxima(values)
|
||||
assert maxima == expected
|
Loading…
Add table
Add a link
Reference in a new issue