sorenisanerd / mock

Automatically exported from code.google.com/p/mock
BSD 2-Clause "Simplified" License
0 stars 0 forks source link

make mock_calls' call() to have attributes for args and kwargs #164

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Currently mock_calls returns list of mock calls, each of who'se is call() 
object that is basically tuple, 2nd element of which is args and 3rd is kwargs.

I'd suggest adding .args and .kwargs attributes to that, since I just wrote a 
code that looks like this:

        data = se.json.dumps.mock_calls[0][1][0][0]  # black magic

Instead, it would at least look like this:

        data = se.json.dumps.mock_calls[0].args[0][0]  # black magic

Which seems much more readable and intuitive as for me. What do you think?

Original issue reported on code.google.com by k...@k-bx.com on 25 Jun 2012 at 1:27

GoogleCodeExporter commented 9 years ago
It's a great idea. Unfortunately you *just* missed the beta cutoff, so this 
change will have to be in Python 3.4.

Original comment by fuzzyman on 25 Jun 2012 at 4:43

GoogleCodeExporter commented 9 years ago
I'm ok with pip install -U mock :)

Original comment by k...@k-bx.com on 28 Jun 2012 at 9:23

GoogleCodeExporter commented 9 years ago
Was this ever included?

Original comment by ahug...@enthought.com on 15 Jul 2013 at 6:19

GoogleCodeExporter commented 9 years ago
This seems trivial to implement, so feel free for a pull request.

Original comment by k...@k-bx.com on 15 Jul 2013 at 6:22