Tuesday, October 14, 2008

Mocking in Python just got easier

Voidspace just released Mock 0.4.0 - an update to the excellent Mock library which brings a few conveniences and easier patching of module and class-level attributes.

This makes tests using mocks easier to read, for example inside a test case:

self.assertEquals(my_mock.my_method.call_args,
(('goodbye',),{'hello': False}))

Can now be written as:

my_mock.my_method.assert_called_with('goodbye', hello=False)


Check it out!

No comments: