This assumes you have setup your environment as described in 1-run_tests.md and that you are in your virtualenv.
If you get stuck, take a peek at the solution.
-
We will be writing tests for catmath.py. This module contains only one function
cat_years_to_hooman_years
. -
Look at the existing tests. You can see there are test stubs:
test__cat_years_to_hooman_years__middle_age__succeeds
test__cat_years_to_hooman_years__less_than_one_year__succeeds
test__cat_years_to_hooman_years__0__returns_0
-
Fill in the body of these tests. Based on their names, what test case do you think each of these is trying to cover?
Each test should be calling
cat_years_to_hooman_years
with different input and asserting based on the output. -
When you have filled in the body of these tests, run them:
(catpy)user@host:~/catinabox$ python setup.py test
Try to write some tests for is_cat_leap_year
. (When
these tests run successfully, you should see an increase in coverage!) Are
you sufficiently convinced that this function works now? Why or why not?
We'd love to have a discussion about this with you if you get this far. Every developer will have different opinions about this :)