<div class="gmail_quote">On Mon, Jan 9, 2012 at 7:26 PM, Michael Foord <span dir="ltr">&lt;<a href="mailto:michael@voidspace.org.uk">michael@voidspace.org.uk</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


  
    
  
  <div bgcolor="#FFFFFF" text="#000000"><div class="im">
    On 10/01/2012 00:16, Michael Foord wrote:
    <blockquote type="cite">
      
      On 09/01/2012 22:41, Tom Davis wrote:
      <blockquote type="cite">I have a mock that is using assert_called_with() and
        mock.ANY thus:<br>
        <br>
        <div style="margin-left:40px">m = mock.Mock()<br>
          do_stuff(m)<br>
          m.assert_called_with(now=mock.ANY, foo=&#39;bar&#39;)<br>
          <br>
        </div>
        Unfortunately, this results in:<br>
        <br>
        <div style="margin-left:40px">AssertionError: Expected call:
          mock(now=&lt;ANY&gt;, foo=&#39;bar&#39;)<br>
          Actual call: mock(now=datetime.datetime(2012, 1, 9, 22, 36,
          41, 264838), foo=&#39;bar&#39;)<br>
        </div>
        <br>
        I could have sworn that ANY used to work perfectly fine when
        used in this way. Is this a datetime thing or...?<br>
        <br>
        Using mock==dev<br>
      </blockquote>
      <br>
      Hmmm... dammit. I see the same thing, but I think I see the cause
      of the problem:<br>
      <br>
    </blockquote>
    <br></div>
    Fixed on trunk. I&#39;ll do a 0.8rc2 release shortly including this fix.</div></blockquote><div><br></div><div>Thanks Michael--for the great library and the always-prompt responses here :)</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div bgcolor="#FFFFFF" text="#000000"><span class="HOEnZb"><font color="#888888"><br>
    <br>
    Michael</font></span><div><div class="h5"><br>
    <br>
    <blockquote type="cite">
      &gt;&gt;&gt; from mock import Mock, ANY<br>
      &gt;&gt;&gt; from datetime import datetime<br>
      &gt;&gt;&gt; d = datetime.now()<br>
      &gt;&gt;&gt; m = Mock()<br>
      &gt;&gt;&gt; m(d)<br>
      &lt;Mock name=&#39;mock()&#39; id=&#39;4312271632&#39;&gt;<br>
      &gt;&gt;&gt; m.assert_called_with(ANY)<br>
      Traceback (most recent call last):<br>
       ...<br>
      AssertionError: Expected call: mock(&lt;ANY&gt;)<br>
      Actual call: mock(datetime.datetime(2012, 1, 10, 0, 13, 52,
      593795))<br>
      &gt;&gt;&gt; ANY == d<br>
      True<br>
      &gt;&gt;&gt; d == ANY<br>
      False<br>
      <br>
      It only happens with certain types:<br>
      <br>
      &gt;&gt;&gt; m(3)<br>
      &lt;Mock name=&#39;mock()&#39; id=&#39;4312271632&#39;&gt;<br>
      &gt;&gt;&gt; m.assert_called_with(ANY)<br>
      &gt;&gt;&gt;<br>
      <br>
      I&#39;ll try and fix this, thanks for the report.<br>
      <br>
      All the best,<br>
      <br>
      Michael Foord<br>
      <blockquote type="cite"> <br>
        <fieldset></fieldset>
        <br>
        <pre>_______________________________________________
testing-in-python mailing list
<a href="mailto:testing-in-python@lists.idyll.org" target="_blank">testing-in-python@lists.idyll.org</a>
<a href="http://lists.idyll.org/listinfo/testing-in-python" target="_blank">http://lists.idyll.org/listinfo/testing-in-python</a>
</pre>
      </blockquote>
      <br>
      <br>
      <pre cols="72">-- 
<a href="http://www.voidspace.org.uk/" target="_blank">http://www.voidspace.org.uk/</a>

May you do good and not evil
May you find forgiveness for yourself and forgive others
May you share freely, never taking more than you give.
-- the sqlite blessing <a href="http://www.sqlite.org/different.html" target="_blank">http://www.sqlite.org/different.html</a>
</pre>
      <br>
      <fieldset></fieldset>
      <br>
      <pre>_______________________________________________
testing-in-python mailing list
<a href="mailto:testing-in-python@lists.idyll.org" target="_blank">testing-in-python@lists.idyll.org</a>
<a href="http://lists.idyll.org/listinfo/testing-in-python" target="_blank">http://lists.idyll.org/listinfo/testing-in-python</a>
</pre>
    </blockquote>
    <br>
    <br>
    <pre cols="72">-- 
<a href="http://www.voidspace.org.uk/" target="_blank">http://www.voidspace.org.uk/</a>

May you do good and not evil
May you find forgiveness for yourself and forgive others
May you share freely, never taking more than you give.
-- the sqlite blessing <a href="http://www.sqlite.org/different.html" target="_blank">http://www.sqlite.org/different.html</a>
</pre>
  </div></div></div>

</blockquote></div><br>