title: Mock Confusion with Path
body: <p>I have a test below using <code>mock</code> on Python 2.6.</p>
  
  <pre><code>@patch('testme.check.RE.query')
  def test_check(query):
    query.filter.one = MagicMock(return_value=None)
    ....
    assert against_experiment(cl, ei, cd)
  </code></pre>
  
  <p>Inside the module I want to test, I have</p>
  
  <pre><code>def check_against_experiment(c, e, c):
    re = RE.query.filter(RE.e_id == e).one()
  </code></pre>
  
  <p>Two questions:</p>
  
  <p>When inspecting <code>re = RE.query.filter(RE.e_id == e).one()</code>, I see <code>&lt;MagicMock name='query.filter().one()' id='62856528'&gt;</code>.</p>
  
  <p>Why isn't this returning <code>None</code>?</p>
  
  <p>Another question is when I change <code>@path('testme.check.RE.query')</code> to <code>@path('testme.check.RE.query')</code> and change <code>query.filter.one</code> to <code>query.one</code>, I notice that nothing is mocked out. Why is this the case?</p>