From 8b2cd75bdd22c2770960f186fb945b5de1eca524 Mon Sep 17 00:00:00 2001 From: Andrew Svetlov Date: Sun, 7 Apr 2013 16:42:24 +0300 Subject: Process DEFAULT values in mock side_effect that returns iterator. Patch by Michael Ford. --- Lib/unittest/mock.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Lib/unittest/mock.py') diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py index 57bf957a98e..073869a1f12 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) -- cgit v1.2.3