This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author p-ganssle
Recipients ElizabethU, p-ganssle, serhiy.storchaka, xtreak
Date 2019-07-15.14:20:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1563200409.62.0.480955192044.issue37555@roundup.psfhosted.org>
In-reply-to
Content
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`.
History
Date User Action Args
2019-07-15 14:20:09p-gansslesetrecipients: + p-ganssle, serhiy.storchaka, xtreak, ElizabethU
2019-07-15 14:20:09p-gansslesetmessageid: <1563200409.62.0.480955192044.issue37555@roundup.psfhosted.org>
2019-07-15 14:20:09p-gansslelinkissue37555 messages
2019-07-15 14:20:09p-gansslecreate