TDM 30100: Project 6 — 2022
Motivation: Code, especially newly written code, is refactored, updated, and improved frequently. It is for these reasons that testing code is imperative. Testing code is a good way to ensure that code is working as intended. When a change is made to code, you can run a suite a tests, and feel confident (or at least more confident) that the changes you made are not introducing new bugs. While methods of programming like TDD (test-driven development) are popular in some circles, and unpopular in others, what is agreed upon is that writing good tests is a useful skill and a good habit to have.
Context: This is the first of a series of two projects that explore writing unit tests, and doc tests. In The Data Mine, we will focus on using
pytest, doc tests, and
mypy, while writing code to manipulate and work with data.
Scope: Python, testing, pytest, mypy, doc tests
We will dig in a little deeper in the next project, however, this project is designed to give you a little bit of a rest before October break.
We’ve provided you with two files for this project:
Start by copying these files to your own working directory.
rm -rf $HOME/project06 || true
cp /anvil/projects/tdm/etc/project06.py $HOME/project06
cp /anvil/projects/tdm/etc/test_project06.py $HOME/project06
The first file,
project06.py is a module with a bunch of functions. The second file,
test_project06.py is the set of tests for the
project06.py module. You can run the tests as follows.
python3 -m pytest
The goal of this project is to fix all of the code in
project06.py so that all of the unit tests pass. Do not modify the tests in
test_project06.py, only modify the code in
.ipynbnotebook file with a
bashcell showing 100 percent of your tests passing.
.ipynbnotebook file with a markdown cell for each question, and an explanation of what was wrong, and how you fixed it.
Please make sure to double check that your submission is complete, and contains all of your code and output before submitting. If you are on a spotty internet connection, it is recommended to download your submission after submitting it to make sure what you think you submitted, was what you actually submitted.
In addition, please review our submission guidelines before submitting your project.