<div dir="ltr">Michael-<div>Thanks for your response.  I&#39;m using mock.py version 1.0.  I&#39;ll try to upgrade to mock 1.0.1, and if I still see this behavior, I&#39;ll definitely submit this as a bug.</div><div>
<br></div><div>Note that your test didn&#39;t really demonstrate whether __lt__ was &quot;implemented&quot;, since it would be called even if the return value were NotImplemented.  In my copy of mock.py (version 1.0), I see this:</div>


<div><div>_return_values = {</div><div>    &#39;__lt__&#39;: NotImplemented,</div><div>    &#39;__gt__&#39;: NotImplemented,</div><div>    &#39;__le__&#39;: NotImplemented,</div><div>    &#39;__ge__&#39;: NotImplemented,</div>


<div>   etc.</div><div><br></div><div>And this behavior:</div><div><br></div><div><div>&gt;&gt;&gt; from mock import MagicMock</div><div>&gt;&gt;&gt; m = MagicMock()</div><div>&gt;&gt;&gt; m.__lt__</div>
<div>&lt;MagicMock name=&#39;mock.__lt__&#39; id=&#39;47908705590288&#39;&gt;</div></div><div>&gt;&gt;&gt; m.__lt__()</div><div><div>NotImplemented</div><div>&gt;&gt;&gt; m &lt; 3</div><div>False</div>
<div>&gt;&gt;&gt; m.__lt__.call_count</div><div>2</div><div><br></div><div style>Thanks again for this great tool,</div></div><div style> Dan W.</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div>

</div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Mon, Jan 28, 2013 at 3:28 AM, Michael Foord <span dir="ltr">&lt;<a href="mailto:fuzzyman@voidspace.org.uk" target="_blank">fuzzyman@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><br>
On 18 Jan 2013, at 19:52, Dan Wandschneider &lt;<a href="mailto:daniel.wandschneider@schrodinger.com" target="_blank">daniel.wandschneider@schrodinger.com</a>&gt; wrote:<br>
<br>
&gt; Under Python 2.7.3 and Mock 1.0.0, we&#39;ve noticed some strange behavior.    On Linux, 0 &lt; MagicMock(), and on Windows 0 &gt; MagicMock().  Has anyone else noticed similar behavior?  Should this be considered a bug?<br>



<br>
</div>That would be a bug, yes. One I&#39;m very surprised about. I don&#39;t think I even have a working Windows VM to try this on though - so I&#39;d be very interested to see if anyone else can verify it.<br>
<div><br>
&gt;<br>
&gt; Note that MagicMock does not implement the inequality comparison operators, which means that in inequality comparisons it delegates the comparison to the other object.  Thus, the expression &quot;MagicMock() &gt; 0&quot; is ultimately evaluated as &quot;0 &lt; MagicMock().&quot;  See Lennert Regebro&#39;s cogent post about total ordering.<br>



<br>
</div>MagicMock *does* implement all the equality and comparison methods. The one used in a &quot;less than&quot; test is __lt__ :<br>
<br>
&gt;&gt;&gt; from mock import MagicMock<br>
&gt;&gt;&gt; m = MagicMock()<br>
&gt;&gt;&gt; m.__lt__<br>
&lt;MagicMock name=&#39;mock.__lt__&#39; id=&#39;4300924432&#39;&gt;<br>
&gt;&gt;&gt; m &lt; 0<br>
False<br>
&gt;&gt;&gt; m &gt; 0<br>
True<br>
&gt;&gt;&gt; m.__lt__.call_count<br>
1<br>
<br>
All the best,<br>
<br>
Michael Foord<br>
<br>
&gt; _______________________________________________<br>
&gt; testing-in-python mailing list<br>
&gt; <a href="mailto:testing-in-python@lists.idyll.org" target="_blank">testing-in-python@lists.idyll.org</a><br>
&gt; <a href="http://lists.idyll.org/listinfo/testing-in-python" target="_blank">http://lists.idyll.org/listinfo/testing-in-python</a><br>
<br>
<br>
--<br>
<a href="http://www.voidspace.org.uk/" target="_blank">http://www.voidspace.org.uk/</a><br>
<br>
<br>
May you do good and not evil<br>
May you find forgiveness for yourself and forgive others<br>
May you share freely, never taking more than you give.<br>
-- the sqlite blessing<br>
<a href="http://www.sqlite.org/different.html" target="_blank">http://www.sqlite.org/different.html</a><br>
<br>
<br>
<br>
<br>
<br>
</blockquote></div><br></div></div>