[issue25597] unittest.mock does not wrap dunder methods (__getitem__ etc)

2021-08-27 Thread Andrei Kulakov
Andrei Kulakov added the comment: I went through dunder methods to check if any other operators or builtins work on objects without respective dunder methods: - del x works even though there is no object.__del__ - operator.length_hint() => 0 when there is no object.__length_hint__ So in a

[issue25597] unittest.mock does not wrap dunder methods (__getitem__ etc)

2020-04-28 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: The change has been reverted as per issue39966. I am reopening this for further discussion. -- resolution: fixed -> stage: resolved -> status: closed -> open ___ Python tracker

[issue25597] unittest.mock does not wrap dunder methods (__getitem__ etc)

2020-04-28 Thread Chris Withers
Chris Withers added the comment: New changeset 521c8d6806adf0305c158d280ec00cca48e8ab22 by Karthikeyan Singaravelan in branch 'master': bpo-39966: Revert "bpo-25597: Ensure wraps' return value is used for magic methods in MagicMock" (GH-19734) https://github.com/python/cpython/commit/521c8d6

[issue25597] unittest.mock does not wrap dunder methods (__getitem__ etc)

2020-04-27 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- pull_requests: +19056 pull_request: https://github.com/python/cpython/pull/19734 ___ Python tracker ___

[issue25597] unittest.mock does not wrap dunder methods (__getitem__ etc)

2020-01-28 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue25597] unittest.mock does not wrap dunder methods (__getitem__ etc)

2020-01-28 Thread Joseph Gordon
Change by Joseph Gordon : -- nosy: -josephgordon ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mai

[issue25597] unittest.mock does not wrap dunder methods (__getitem__ etc)

2020-01-26 Thread Chris Withers
Chris Withers added the comment: New changeset 72b1004657e60c900e4cd031b2635b587f4b280e by Chris Withers (Karthikeyan Singaravelan) in branch 'master': bpo-25597: Ensure wraps' return value is used for magic methods in MagicMock (#16029) https://github.com/python/cpython/commit/72b1004657e60

[issue25597] unittest.mock does not wrap dunder methods (__getitem__ etc)

2019-10-28 Thread Phil Connell
Change by Phil Connell : -- nosy: +pconnell ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyth

[issue25597] unittest.mock does not wrap dunder methods (__getitem__ etc)

2019-09-12 Thread Michael Foord
Michael Foord added the comment: The previous behaviour was unspecified and clearly due to missing functionality, so the advantages of fixing it outweigh any potential compatibility issues. But I'd see it as a feature enhancement for 3.9. -- ___ P

[issue25597] unittest.mock does not wrap dunder methods (__getitem__ etc)

2019-09-12 Thread Michael Foord
Michael Foord added the comment: As discussed with Karthik, I think this is a nice feature enhancement for the wraps functionality and worth fixing. It has the great advantage that the fix is nice and isolated and simple. -- ___ Python tracker

[issue25597] unittest.mock does not wrap dunder methods (__getitem__ etc)

2019-09-12 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- keywords: +patch pull_requests: +15652 stage: test needed -> patch review pull_request: https://github.com/python/cpython/pull/16029 ___ Python tracker

[issue25597] unittest.mock does not wrap dunder methods (__getitem__ etc)

2019-09-11 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: Michael, any thoughts on this? This more feels like an enhancement to me and I have marked it as 3.9 since I am not sure someone might be depending on the behavior where they have used wraps but still expect default values for magicmethods as they

[issue25597] unittest.mock does not wrap dunder methods (__getitem__ etc)

2019-09-09 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: This seems to a reasonable change to me since dict.get returns the value then making a contains check dict.__contains__ should return True instead of the fixed return value of False. Below is a patch where the mock_wraps attribute is set with the r

[issue25597] unittest.mock does not wrap dunder methods (__getitem__ etc)

2019-05-06 Thread anthony shaw
anthony shaw added the comment: The assertions in the attached test still fail on master (3.8a3), so this still applies. Michael, are you able to look at this, the code hasn't changed since the original PEP417 implementation, which doesn't specify if this behaviour should be supported. Th

[issue25597] unittest.mock does not wrap dunder methods (__getitem__ etc)

2018-09-22 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +xtreak ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https:/

[issue25597] unittest.mock does not wrap dunder methods (__getitem__ etc)

2016-03-15 Thread Robert Collins
Robert Collins added the comment: I think this is a valid mock bug; it likely needs some thoughtful exhaustive testing, and obviously support added for it. -- stage: -> test needed title: unittest.mock does not wrap dict objects correctly -> unittest.mock does not wrap dunder methods