summaryrefslogtreecommitdiffstats
path: root/Lib/unittest/mock.py
diff options
context:
space:
mode:
authorAndrew Svetlov <andrew.svetlov@gmail.com>2013-04-07 13:42:24 (GMT)
committerAndrew Svetlov <andrew.svetlov@gmail.com>2013-04-07 13:42:24 (GMT)
commit8b2cd75bdd22c2770960f186fb945b5de1eca524 (patch)
tree296031c5e4d0e8727f0e5f8cafffb2226f474280 /Lib/unittest/mock.py
parent595365de32545316be2c009ef3729084efd0056e (diff)
downloadcpython-8b2cd75bdd22c2770960f186fb945b5de1eca524.zip
cpython-8b2cd75bdd22c2770960f186fb945b5de1eca524.tar.gz
cpython-8b2cd75bdd22c2770960f186fb945b5de1eca524.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 57bf957..073869a 100644
--- a/Lib/unittest/mock.py
+++ b/Lib/unittest/mock.py
@@ -904,6 +904,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)