mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #23661: unittest.mock side_effects can now be exceptions again.
This was a regression vs Python 3.4. Patch from Ignacio Rossi
This commit is contained in:
parent
47066ee3db
commit
f58f88c4c7
4 changed files with 15 additions and 1 deletions
|
@ -506,7 +506,8 @@ class NonCallableMock(Base):
|
|||
if delegated is None:
|
||||
return self._mock_side_effect
|
||||
sf = delegated.side_effect
|
||||
if sf is not None and not callable(sf) and not isinstance(sf, _MockIter):
|
||||
if (sf is not None and not callable(sf)
|
||||
and not isinstance(sf, _MockIter) and not _is_exception(sf)):
|
||||
sf = _MockIter(sf)
|
||||
delegated.side_effect = sf
|
||||
return sf
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue