How can I properly pass a test if a condition is true?
Just a general example:
import pytest
def test_animal_color(color):
fish_color = 'Blue'
if fish_color == color:
# pass the test and don't run anymore code
rat_color = 'Gray'
if rat_color == color:
# pass the test and don't run anymore code
frog_color = 'Green'
if frog_color == color:
# pass the test and don't run anymore code
The real usage for this will be used in a much more complex piece of code of course on which I will have methods inside methods and I want to pass the test when the parameter condition is met, it doesn't matter in which method, the test must pass and the remaining code should no longer run.