summaryrefslogtreecommitdiffstats
path: root/Lib/unittest/mock.py
diff options
context:
space:
mode:
authorAndrew Svetlov <andrew.svetlov@gmail.com>2013-04-07 13:44:07 (GMT)
committerAndrew Svetlov <andrew.svetlov@gmail.com>2013-04-07 13:44:07 (GMT)
commit8ab1e513c1451895afd95ef2e07905ab07dc9909 (patch)
treee3fe65dacc5c5540634c042af00a3ea4651d4993 /Lib/unittest/mock.py
parent5cd72b7b9cd56e059e8c5d980257931213ef64af (diff)
parent8b2cd75bdd22c2770960f186fb945b5de1eca524 (diff)
downloadcpython-8ab1e513c1451895afd95ef2e07905ab07dc9909.zip
cpython-8ab1e513c1451895afd95ef2e07905ab07dc9909.tar.gz
cpython-8ab1e513c1451895afd95ef2e07905ab07dc9909.tar.bz2
Process DEFAULT values in mock side_effect that returns iterator.
Patch by Michael Ford.
Diffstat (limited to 'Lib/unittest/mock.py')
-rw-r--r--Lib/unittest/mock.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py
index 5a1db8a..dc5c033 100644
--- a/Lib/unittest/mock.py
+++ b/Lib/unittest/mock.py
@@ -931,6 +931,8 @@ class CallableMixin(Base):
result = next(effect)
if _is_exception(result):
raise result
+ if result is DEFAULT:
+ result = self.return_value
return result
ret_val = effect(*args, **kwargs)