Michael Foord added the comment:
Can you explain why we need to check for the call_count here? I don't
understand why this is needed.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17826
Kushal Das added the comment:
New patch with fix in proper place for side_effect for functions (includes test
case).
--
versions: +Python 3.3 -Python 3.5
Added file: http://bugs.python.org/file34838/issue17826_v3.patch
___
Python tracker
Roundup Robot added the comment:
New changeset 1e3c64470629 by Michael Foord in branch '3.4':
Issue 17826. Setting an iterable side_effect on a mock created by
create_autospec now works
http://hg.python.org/cpython/rev/1e3c64470629
--
nosy: +python-dev
Changes by Michael Foord mich...@voidspace.org.uk:
--
resolution: - fixed
stage: commit review - committed/rejected
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17826
Éric Araujo added the comment:
Michael, a patch including tests is ready for this issue.
--
nosy: +eric.araujo
stage: patch review - commit review
versions: +Python 3.5 -Python 3.3
___
Python tracker rep...@bugs.python.org
Kushal Das added the comment:
Version 2 of the patch, with typo fixed also one more addition test to check
callable side effect in create_autospec.
--
Added file: http://bugs.python.org/file30055/issue17826_v2.patch
___
Python tracker
Changes by Ezio Melotti ezio.melo...@gmail.com:
--
nosy: +ezio.melotti
stage: needs patch - patch review
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17826
___
Michael Foord added the comment:
This illustrates the difference:
from mock import Mock, create_autospec
some_list = [1, 2, 3]
m = Mock()
m.side_effect = some_list
m.side_effect
listiterator object at 0x1004ab7d0
m2 = create_autospec(lambda: None)
m2.side_effect = some_list
Kushal Das added the comment:
Working on this.
--
nosy: +kushaldas
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17826
___
___
Python-bugs-list
Kushal Das added the comment:
Patch along with a test for the same.
--
keywords: +patch
Added file: http://bugs.python.org/file30025/issue17826_v1.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17826
New submission from Michael Foord:
from unittest.mock import create_autospec
def f(): pass
...
m = create_autospec(f)
m.side_effect = [1, 2]
m()
Traceback (most recent call last):
File stdin, line 1, in module
File string, line 3, in f
File /compile/py3k-cpython/Lib/unittest/mock.py,
Changes by Gregory P. Smith g...@krypto.org:
--
nosy: +gregory.p.smith
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17826
___
___
12 matches
Mail list logo