diff options
author | Andrew Svetlov <andrew.svetlov@gmail.com> | 2013-04-07 13:44:07 (GMT) |
---|---|---|
committer | Andrew Svetlov <andrew.svetlov@gmail.com> | 2013-04-07 13:44:07 (GMT) |
commit | 8ab1e513c1451895afd95ef2e07905ab07dc9909 (patch) | |
tree | e3fe65dacc5c5540634c042af00a3ea4651d4993 /Lib/unittest/test | |
parent | 5cd72b7b9cd56e059e8c5d980257931213ef64af (diff) | |
parent | 8b2cd75bdd22c2770960f186fb945b5de1eca524 (diff) | |
download | cpython-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/test')
-rw-r--r-- | Lib/unittest/test/testmock/testmock.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/unittest/test/testmock/testmock.py b/Lib/unittest/test/testmock/testmock.py index 475a826..127786c 100644 --- a/Lib/unittest/test/testmock/testmock.py +++ b/Lib/unittest/test/testmock/testmock.py @@ -978,6 +978,10 @@ class MockTest(unittest.TestCase): self.assertRaises(StopIteration, mock) self.assertIs(mock.side_effect, this_iter) + def test_side_effect_iterator_default(self): + mock = Mock(return_value=2) + mock.side_effect = iter([1, DEFAULT]) + self.assertEqual([mock(), mock()], [1, 2]) def test_assert_has_calls_any_order(self): mock = Mock() |