Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.
Already on GitHub?
to your account
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
assignee = 'https://github.com/berkerpeksag'
closed_at = <Date 2015-03-12.18:44:21.750>
created_at = <Date 2015-03-04.09:27:01.798>
labels = ['type-feature', 'library']
title = "unittest.mock.MagicMock doesn't support matmul (@) operator"
updated_at = <Date 2015-03-12.18:44:21.748>
user = 'https://bugs.python.org/zkrynicki'
activity = <Date 2015-03-12.18:44:21.748>
actor = 'berker.peksag'
assignee = 'berker.peksag'
closed = True
closed_date = <Date 2015-03-12.18:44:21.750>
closer = 'berker.peksag'
components = ['Library (Lib)']
creation = <Date 2015-03-04.09:27:01.798>
creator = 'zkrynicki'
dependencies = 
files = ['38368']
hgrepos = 
issue_num = 23581
keywords = ['patch']
message_count = 5.0
messages = ['237176', '237434', '237435', '237972', '237973']
nosy_count = 5.0
nosy_names = ['python-dev', 'berker.peksag', 'zkrynicki', 'Saimadhav.Heblikar', 'H\xc3\xa5kan L\xc3\xb6vdahl']
pr_nums = 
priority = 'normal'
resolution = 'fixed'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue23581'
versions = ['Python 3.5']
The text was updated successfully, but these errors were encountered:
Hi. I'm the upstream of Padme, a mostly transparent proxy library for Python. I was adding support for the new matmul/@ operator when I noticed that MagicMock doens't support it yet.
>>> form unittest.mock import MagicMock
>>> MagicMock() @ 1
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for @: 'MagicMock' and 'int'
To add support simply add 'matmul' to unittest.mock.numerics.
Sorry, something went wrong.
Here is a suggestion for a patch. It adds the missing matmul and has a small test for it.
Looks good. I'll tweak the patch and commit it. Thanks Håkan.
New changeset 8c65480a1e19 by Berker Peksag in branch 'default':
Issue bpo-23581: Add matmul support to MagicMock.
Thanks for the patch, Håkan. If you want to add tests for other magic methods, please open a new issue.
Thanks for the report, Zygmunt.
No branches or pull requests