You've created a function called is_highfive(x)
that determines whether a number is a "high five" ✋ which you've defined as a number greater than 100 and divisible by five.
Write and run the following three tests inside test_highfive.py
:
 confirm that 105 is a high five
 confirm that 100 is not a high five
 confirm that 106 is not a high five
Design your test(s) so that every one of these checks runs, regardless of whether one of them fails.
Directory Structure¶
Solution 1¶
Explanation¶
How to run these tests
What about this?
When you put multiple assertions in one test function, if one of the assertions fails, the function stops executing and none of the remaining assertions are tested. In other words, test functions pass or fail "as a whole". Sometimes this is desirable, but in this example we wanted each test to run, regardless of whether one of them fails.
Solution 2¶
Explanation¶
This is equivalent to Solution 1 but less wordy.

Define a generic test function with two parameters:
test_input
andexpected
. 
Decorate the function with the
@pytest.mark.parametrize
decorator, passing in a string representation of the input parameters
 a list of (a, b) tuples representing each (
test_input
,expected
) pair
Note that using the parametrize decorator requires us to
import pytest
.