mock.side_effect can take an iterable in Python November 29, 2019 m = MagicMock(side_effect=[1, 2]) m() # 1 m() # 2