We'll walk through some of the simplest—and most useful—features of Mocker. To do that, we'll write tests that describe a class representing a specific mathematical operation (multiplication) which can be applied to the values of arbitrary other mathematical operation objects. In other words, we'll work on the guts of a spreadsheet program (or something similar).

We're going to use Mocker to create mock objects to stand in place of the real operation objects.

- Create up a text file to hold the tests, and add the following at the beginning (assuming that all the mathematical operations will be defined in a module called
`operations`

):>>> from mocker import Mocker >>> import operations

- We've decided ...

Start Free Trial

No credit card required