Test cases of mymath
We could create a data structure holding all the cases and add a loop to the test function. e.g. to test the add function we could create list of tuples where in each tuple the first two values are the input values and the last one is the expected output.
import mymath
# We can create a dataset of the test-cases and loop over them.
def test_add_cases():
cases = [
(1, 1, 2),
(2, 3, 5),
(-1, 1, 0),
]
for (a, b, expected) in cases:
assert mymath.add(a, b) == expected