Closed GoogleCodeExporter closed 9 years ago
I can confirm this happens, and it's very odd. Investigating.
Original comment by fuzzyman
on 18 Mar 2013 at 10:39
Ok, so the reason for this is that mock returns NotImplemented for these
comparisons. Python 3 (the interpreter) does the sane thing and raises an
exception because the comparison is not meaningful.
Python 2 tries to guess - and returns a result based on comparing the *types*!
Python 2.7 is returning different results for this operation on different
platforms:
>>> MagicMock < int
False
Changing mocks to return something other than NotImplemented would be backwards
incompatible - so where your tests are depending on the results of the
comparison I think you need to explicitly set the result.
On the other hand, filing a bug against Python for inconsistent results would
be perfectly acceptable.
Original comment by fuzzyman
on 18 Mar 2013 at 11:54
Original issue reported on code.google.com by
dwandsch...@gmail.com
on 28 Jan 2013 at 7:14