Mario Corchero added the comment:

Whilst I agree that using spec can be used for a similar purpose and I did not 
know about being able to do nested definitions via the arguments (the 
**{"method1.return_value": 1}, really cool!) I find the idea of allowing users 
to halt the mock generation really useful. It is much less disruptive and feels 
more natural.

Compare:
>>> inner_m = Mock(spec=["method2"], **{"method2.return_value": 1})
>>> m = Mock(spec=["method1"], **{"method1.return_value": inner_m})

with: 
>>> m = mock.Mock()
>>> m.method1().method2() = 1
>>> mock.seal(m)


In brief, seal allows users to just add the method to their existing workflow 
where they use generic mocks. Moreover, it is extremely user friendly, many of 
the developers that struggle with the mocking module found seal really helpful.

----------

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

Reply via email to