[issue24651] Mock.assert* API is in user namespace

Michael Foord report at bugs.python.org
Wed Jul 22 12:22:34 CEST 2015


Michael Foord added the comment:

I'm not wild about this idea. The problem with the assert methods has *essentially* been solved now, so I'm not convinced of the need for this change (unless users really *need* to have their own mocked attributes like "assert_called_with" which I think is highly unlikely).

Part of the genius of mock was providing a flexible mock object that also encapsulated simple methods for introspecting/asserting how it has been used. Changing to require users to import/know about a whole host of separate functions doesn't feel like an improvement to me. That's aside from the whole "breaking people's code for no tangible benefit" issue.

I acknowledge that other people, Carl for example, have different opinions - but from talking to many, many mock users over the years I think that those with the philosophically purist approach are in a minority to those who appreciate the more practical approach that mock takes.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24651>
_______________________________________


More information about the Python-bugs-list mailing list