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:
Robert Collins 2015-07-14 13:51:40 +12:00
parent 47066ee3db
commit f58f88c4c7
4 changed files with 15 additions and 1 deletions

View file

@ -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