Substitute a mock object for the metaclass of a class

Matt Wheeler m at funkyhat.org
Mon Mar 13 19:01:44 EDT 2017


A small correction...

On Mon, 13 Mar 2017 at 22:36 Matt Wheeler <m at funkyhat.org> wrote:

> ```
> from unittest.mock import patch
>
> import lorem
>
>
> @patch('lorem.type')
> def test_things(mocktype):
>     lorem.quux(metameta.Foo())
>
>     lorem.return_value.assert_called_with()
>
this line should of course read `mocktype.return_value.assert_called_with()`

> ```
>
-- 

--
Matt Wheeler
http://funkyh.at



More information about the Python-list mailing list