Arnav Khare added the comment:
Added a test to the patch supplied.
--
nosy: +Arnav.Khare
Added file:
http://bugs.python.org/file27335/mock_assert_called_once_with_output_update_including_test.patch
___
Python tracker rep...@bugs.python.org
Roundup Robot added the comment:
New changeset 70d43fedb2d7 by Michael Foord in branch 'default':
Closes issue 15323. Improve failure message of Mock.assert_called_once_with
http://hg.python.org/cpython/rev/70d43fedb2d7
--
nosy: +python-dev
resolution: - fixed
stage: -
Éric Araujo added the comment:
Cool change. I assume when you use mock.patch as decorator the mock name is
set to the mocked object?
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15323
Michael Foord added the comment:
Eric: yes, patch sets the name on the mock objects it creates. A mock only
knows its direct name, not its full 'dotted' name (i.e. a mock knows it is
called 'time' but not that it is 'time.time'). It is possible (but harder) to
deduce that name (follow the
Éric Araujo mer...@netwok.org added the comment:
Nice idea! A small question: Why print 'time' in the message and not
'time.time'?
--
nosy: +eric.araujo
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15323
Michael Foord mich...@voidspace.org.uk added the comment:
Looks good, thanks.
--
assignee: - michael.foord
nosy: +michael.foord
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15323
___
New submission from Brian Jones bkjo...@gmail.com:
In Python 3.3.0b1, if the number of calls to a mock is, say, zero, and you call
assert_called_once_with() on that mock, it will throw an exception which says
Expected to be called once. Called 0 times.
This is nice, but it would be nicer if
Chris Jerdonek chris.jerdo...@gmail.com added the comment:
I have a minor suggestion. I would suggest--
+ msg = (Expected %s to be called once. Called %s times. %
+(repr(self._mock_name) or 'mock', self.call_count))
so that one can distinguish between self._mock_name not being defined