Unit tests with Python


/ Published in: Python
Save to your folder(s)

Test-first programming, in which you write the unit tests first with the unittest module and then work on the code until it passes all the tests, seems like a good substitute for writing interfaces or documentation first. The unit tests are like an API, describing the interface of the code being tested. And they lend themselves well to refactoring.

This is a first attempt at a unit test for the messager.py module posted earlier.

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.