[issue30949] Provide assertion functions in unittest.mock

2017-10-26 Thread Berker Peksag
Berker Peksag added the comment: Thank you for the report. This is a duplicate of issue 24651. -- components: +Library (Lib) -Tests nosy: +berker.peksag resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> Mock.assert* API is in user namespace type: -> e

[issue30949] Provide assertion functions in unittest.mock

2017-07-17 Thread ppperry
ppperry added the comment: You can already do this, although it it somewhat of a hack: >>> assert_called_once=Mock.assert_called_once # This will be an AttributeError >>> assert_called_once_with=Mock.assert_called_once_with >>> example = Mock() >>> assert_caled_once_with(example, ...) # A NameE

[issue30949] Provide assertion functions in unittest.mock

2017-07-17 Thread tribaal
Changes by tribaal : -- nosy: +tribaal ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/

[issue30949] Provide assertion functions in unittest.mock

2017-07-17 Thread Daniel Watkins
New submission from Daniel Watkins: The convenience assertion methods on mock objects can be easily mistyped and if they are mistyped, they will silently pass. This can be quite user-hostile. Consider the following: >>> example = Mock() >>> example.assert_called_once() >>> example.assert_cal