I think something like this sort of answers my question, I just don't know how to implement it.
I wrote this function:
def print_max(list_name,k):
for i in range(len(list_name)-(k-1)):
yield (max(list_name[i:i+k]))
print(print_max([10,5,2,7,8,7],3))
I want to add this to a pytest. This is usually how i run pytest:
@pytest.marks.parametrize('input1','output1',[[10,5,2,7,8,7], X]:
def test_fun(input1, output1):
assert print_max(input1) == output1
What would I change X to in this pytest to allow for the function to have a yield output? Or what's the best way to do this pytest, given the function is a yield?