You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
El test falla si se hace como funciones, pero no si se hace imperativo. Se hizo con funciones porque en los anteriores ya se venía pidiendo hacer funciones, por lo que creo que es importante permitirlo
The text was updated successfully, but these errors were encountered:
@pytest.mark.it("The function should print the minimum number from my_list")deftest_printed_output(capsys, app):
defminInteger_wrapper(my_list):
result=app.minInteger(my_list)
print(result)
returnresultoriginal_minInteger=app.minIntegerapp.minInteger=minInteger_wrapperexec(open(app.__file__).read())
captured=capsys.readouterr()
app.minInteger=original_minIntegerassertint(captured.out.strip()) ==min(app.my_list)
Explanation:
It defines a minInteger_wrapper function that calls the original minInteger function, prints the result, and returns it.
It temporarily replaces the minInteger function in the app module with the wrapper function.
It re-executes the app.py file, which now calls the wrapper function instead of the original minInteger function, and thus captures the printed output.
It restores the original minInteger function in the app module.
It checks if the captured output matches the minimum value in my_list.
ejercicio 09.1 pythonlist:
09.1 Minimum integer:
El test falla si se hace como funciones, pero no si se hace imperativo. Se hizo con funciones porque en los anteriores ya se venía pidiendo hacer funciones, por lo que creo que es importante permitirlo
The text was updated successfully, but these errors were encountered: