Created
July 25, 2011 17:27
-
-
Save YoniTsafir/1104645 to your computer and use it in GitHub Desktop.
mock 0.8 beta1 bug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Old version: | |
>>> from mock import MagicMock | |
>>> a = MagicMock() | |
>>> a.foo("hello") | |
<mock.MagicMock object at 0xa40cecc> | |
>>> a.foo("goodbye") | |
<mock.MagicMock object at 0xa40cecc> | |
>>> a.foo.call_args_list | |
[(('hello',), {}), (('goodbye',), {})] | |
>>> a.foo.call_args_list[0] | |
(('hello',), {}) | |
>>> a.foo.call_args_list[0][0] | |
('hello',) | |
>>> a.foo.call_args_list[0][0][0] | |
'hello' | |
# New version: | |
>>> from mock import MagicMock | |
>>> a = MagicMock() | |
>>> a.foo("hello") | |
<mock.MagicMock object at 0x9f704ec> | |
>>> a.foo("goodbye") | |
<mock.MagicMock object at 0x9f704ec> | |
>>> a.foo.call_args_list | |
[(('hello',), {}), (('goodbye',), {})] | |
>>> a.foo.call_args_list[0] | |
(('hello',), {}) | |
>>> a.foo.call_args_list[0][0] | |
'' | |
>>> a.foo.call_args_list[0][0][0] | |
Traceback (most recent call last): | |
File "<stdin>", line 1, in <module> | |
IndexError: string index out of range |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment