

@mock.patch.object(FooWithError, 'error', new_callable=mock.PropertyMock)
def test_load_raises_exception_on_error(self, error_mock, is_loaded_mock, time_mock):
    error_mock.side_effect = [spotify.ErrorType.IS_LOADING, spotify.ErrorType.OTHER_PERMANENT]
    is_loaded_mock.side_effect = [False, False, True]
    foo = FooWithError(self.session)
    with self.assertRaises(spotify.Error):
        foo.load()
    self.assertEqual(self.session.process_events.call_count, 1)
    self.assertEqual(is_loaded_mock.sleep.call_count, 0)

dataset/ETHPy150Open mopidy/pyspotify/tests/test_loadable.py LoadableTest.test_load_raises_exception_on_error/VarMisuse@111/160 `time_mock`->`is_loaded_mock`