mock with inheritance

Ben Finney bignose+hates-spam at
Wed Jul 9 13:12:25 CEST 2008

lidiriel <ludovic.mercier at> writes:

> But i don't know how to mock the class Component. Note that Component
> provide the attribut env.

I prefer to use the MiniMock framework

You don't need to specify what interface the mock object has. Its Mock
objects will allow *any* attribute access, method or otherwise, and
simply report what was done. You can then check that report to see if
it matches what you expect; the author suggests that the existing
standard-library 'doctest' module is ideal for such checking.

 \       “It is the mark of an educated mind to be able to entertain a |
  `\                         thought without accepting it.” —Aristotle |
_o__)                                                                  |
Ben Finney

More information about the Python-list mailing list