Paul Ganssle <p.gans...@gmail.com> added the comment:

Maybe I am missing something, but while it is true that DjangoModel is doing 
the wrong thing by returning False instead of NotImplemented, the `ANY` 
sentinel is supposed to match *anything*, not just things that compare equal to 
it, right? I would expect this to work, for example:

  class EqualsNothing:
    def __eq__(self, other):
        return False

  m = Mock(spec_set=EqualsNothing)
  obj = EqualsNothing()
  m(obj)
  m.assert_has_calls([call(ANY)])

In that example, it is deliberate that EqualsNothing returns False for any 
type, but ANY should still match it. I think maybe the solution here is to 
special-case the matching with ANY so the criterion for a call matching would 
be `y is ANY or x == y`.

----------
nosy: +p-ganssle

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue37555>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to