Code from Testing Python book