Make unittest.mock.Mock() return list of dicts
<p>I'm trying to mock a call of method <code>extra_get()</code> which usually returns a list of dicts. As far as I understand from the Mock <a href="https://docs.python.org/3/library/unittest.mock.html#unittest.mock.Mock" rel="nofollow">docs</a>, if I want to return iterable, I should set side_effect param.</p>

<pre><code>client.extra_get = mock.Mock(
            **{'side_effect': [{'foo': 'bar'}]})
</code></pre>

<p>But then the following code calls that mocked method:</p>

<pre><code>extra = client.extra_get(request, type_id)
result = {x.key: x.value for x in extra}
return result
</code></pre>

<p>And the dict comprehention fails because <code>extra</code> there is not a list, but dict <code>{'foo': 'bar'}</code>.
What I'm doing wrong? How can I make Mock method return a list of dicts?</p>