title: Is there a way to assert that an attribute has been set on a unittest mock object?
body: <p>In the following code, is there a way to assert that the <code>query</code> attribute has been set if search is a mock object? Or if <code>query</code> was the mock object, is there a way to do it? </p>
  
  <pre><code>search.query = Q('bool', must=must)
  </code></pre>
  
  <p>So far I've found out that Python unittest.mock only supports asserting that mocks have been called as functions. Also the <strong>setattr</strong> magic method can not be mocked so <code>search.__setattr__</code> can not be used to assert the above.</p>