[issue20968] mock.MagicMock does not mock __truediv__

2014-04-14 Thread Michael Foord
Michael Foord added the comment: Thanks! -- assignee: -> michael.foord resolution: -> fixed stage: -> committed/rejected status: open -> closed ___ Python tracker ___

[issue20968] mock.MagicMock does not mock __truediv__

2014-04-14 Thread Roundup Robot
Roundup Robot added the comment: New changeset 445ef3b58109 by Michael Foord in branch '3.4': Issue 20968. unittest.mock.MagicMock now supports division http://hg.python.org/cpython/rev/445ef3b58109 -- nosy: +python-dev ___ Python tracker

[issue20968] mock.MagicMock does not mock __truediv__

2014-04-01 Thread Raymond Hettinger
Raymond Hettinger added the comment: The patch looks clean and correct. It passes the test suite. I recommend going ahead and applying the patch. -- nosy: +rhettinger ___ Python tracker __

[issue20968] mock.MagicMock does not mock __truediv__

2014-03-31 Thread Johannes Baiter
Johannes Baiter added the comment: Sorry for commenting so late, I submitted a version of the patch with unit tests roughly two weeks ago, I just forgot to mention it in a comment. Hereby fixed :-) -- ___ Python tracker

[issue20968] mock.MagicMock does not mock __truediv__

2014-03-19 Thread Johannes Baiter
Changes by Johannes Baiter : Added file: http://bugs.python.org/file34515/mock_truediv_with_tests.diff ___ Python tracker ___ ___ Python-bugs-

[issue20968] mock.MagicMock does not mock __truediv__

2014-03-19 Thread Michael Foord
Michael Foord added the comment: Well, as this is a regression fix we definitley need a test. Ideally we would test all the operations - I didn't realise that only add was tested! However for this specific issue, just testing division is fine, and yes testing in place and right hand as well wo

[issue20968] mock.MagicMock does not mock __truediv__

2014-03-19 Thread Johannes Baiter
Johannes Baiter added the comment: >From looking at 'test_numerics', only 'add' is currently tested. Probably since the mechanism for all of the numeric magic methods is the same (i.e. create , __i__, __r__). Should I add a test for __truediv__ and its inplace and right variants nonetheles

[issue20968] mock.MagicMock does not mock __truediv__

2014-03-19 Thread Michael Foord
Michael Foord added the comment: A test would be nice please (good catch on the bug). -- ___ Python tracker ___ ___ Python-bugs-list m

[issue20968] mock.MagicMock does not mock __truediv__

2014-03-18 Thread Ned Deily
Changes by Ned Deily : -- nosy: +michael.foord ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyt

[issue20968] mock.MagicMock does not mock __truediv__

2014-03-18 Thread Johannes Baiter
Johannes Baiter added the comment: I just noticed that I put the magic method names in the wrong place in the patch. Attached is a fix that adds 'truediv' to the global 'numberics' variable, this way '__rtruediv__' and '__itruediv__' will be correctly mocked as well. -- Added file: htt

[issue20968] mock.MagicMock does not mock __truediv__

2014-03-18 Thread Johannes Baiter
Johannes Baiter added the comment: Attached is a patch that fixes the issue for me. -- keywords: +patch Added file: http://bugs.python.org/file34490/mock_truediv.diff ___ Python tracker

[issue20968] mock.MagicMock does not mock __truediv__

2014-03-18 Thread Johannes Baiter
New submission from Johannes Baiter: It seems that when creating a MagicMock the magic '__truediv__' method is not replaced with a mock: >>> import mock >>> foo = mock.MagicMock() >>> foo / 2 Traceback (most recent call last): File "", line 1, in TypeError: unsupported operand type(s) for /: