Exercises
Running coverage a few times will help you learn how easy and powerful it is. We’ll start out easy and get a little more exciting with these exercises.
-
Coverage for single_file.py showed 94%.
-
Add a command-line flag to include which lines are missing in the terminal report.
-
Bonus: Add or change a test to get to 100%.
-
-
The example for some_code showed the coverage at 92%.
-
Generate an HTML report to find out what code is missing.
-
Bonus: Add or change a test to get to 100%.
-
-
For Cards, we found a few missing lines in api.py related to filtering the list command.
-
Run a coverage report and make sure you see the three missing lines of code in api.py.
-
Extend ch7/test_list.py by writing three new test functions to satisfy the new test cases: ...
-
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access