mirror of
https://github.com/python/cpython.git
synced 2025-07-24 03:35:53 +00:00
Process DEFAULT values in mock side_effect that returns iterator.
Patch by Michael Ford.
This commit is contained in:
commit
8ab1e513c1
2 changed files with 6 additions and 0 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue