Files
courses/py3interm/EXAMPLES/pytests/test_parametrization.py
T
2025-05-20 11:57:43 -04:00

19 lines
419 B
Python

#!/usr/bin/env python
import pytest
def triple(x): # <1>
return x * 3
test_data = [(5, 15), ('a', 'aaa'), ([True], [True, True, True])] # <2>
@pytest.mark.parametrize("input,result", test_data) # <3>
def test_triple(input, result): # <4>
print("input {} result {}:".format(input, result)) # <4>
assert triple(input) == result # <5>
if __name__ == "__main__":
pytest.main([__file__, '-s'])