Message350688
As reported on StackOverflow:
https://stackoverflow.com/questions/57636747/how-to-perform-assert-has-calls-for-a-getitem-call
The following code would output: [call(), call().foo(), call().foo().__getitem__('bar')]
from unittest.mock import MagicMock, call
mm = MagicMock()
mm().foo()['bar']
print(mm.mock_calls)
but trying to use that list with mm.assert_has_calls([call(), call().foo(), call().foo().__getitem__('bar')]) would result in:
TypeError: tuple indices must be integers or slices, not str |
|
Date |
User |
Action |
Args |
2019-08-28 20:33:01 | blhsing | set | recipients:
+ blhsing |
2019-08-28 20:33:01 | blhsing | set | messageid: <1567024381.55.0.529292089661.issue37972@roundup.psfhosted.org> |
2019-08-28 20:33:01 | blhsing | link | issue37972 messages |
2019-08-28 20:33:01 | blhsing | create | |
|