New submission from Antoine Pitrou:

assert_called_with currently compares every argument for equality, which is not 
very practical when one of the arguments is a complex object, of which you only 
want to check certain properties.

It could be very nice if you could write e.g.:

from mock import Mock, PLACEHOLDER

...
my_mock(1, someobj(), bar=someotherobj()):
foo, bar = my_mock.assert_called_with(
    1, PLACEHOLDER, bar=PLACEHOLDER)
self.assertIsInstance(bar, someobj)
self.assertIsInstance(foo, someotherobj)


(another name for PLACEHOLDER could be CAPTURE, regex-style :-))

----------
messages: 180852
nosy: michael.foord, pitrou
priority: normal
severity: normal
status: open
title: assert_called_with could be more powerful if it allowed placeholders
type: enhancement
versions: Python 3.4

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue17063>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to