diff options
author | Robert Collins <rbtcollins@hp.com> | 2015-07-14 13:51:40 +1200 |
---|---|---|
committer | Robert Collins <rbtcollins@hp.com> | 2015-07-14 13:51:40 +1200 |
commit | a3fffb0539010a73dc9fb808aa504712a63b7bc4 (patch) | |
tree | eba8bde8336856b08a4ee67f70858fea1deddaa1 /Lib/unittest/mock.py | |
parent | dc87e4b88551f64cb4053d8ea72dffc0c3675413 (diff) | |
download | cpython-git-a3fffb0539010a73dc9fb808aa504712a63b7bc4.tar.gz |
Issue #23661: unittest.mock side_effects can now be exceptions again.
This was a regression vs Python 3.4. Patch from Ignacio Rossi
Diffstat (limited to 'Lib/unittest/mock.py')
-rw-r--r-- | Lib/unittest/mock.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py index c3ab4e82e8..191a175a41 100644 --- a/Lib/unittest/mock.py +++ b/Lib/unittest/mock.py @@ -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 |