def test_stream_with_regular_exceptions(self, error_translator, session, url): svc = HTTPService(session, error_translator) session.request.return_value.iter_content.side_effect = ValueError with pytest.raises(ValueError): list(svc.stream("GET", url))
def test_stream_with_error_translator_defaults( self, error_translator, session, generator_exception, expected_exception, url, ): svc = HTTPService(session, error_translator) def explode(): yield b"response-part-1" raise generator_exception session.request.return_value.iter_content.return_value = explode() with pytest.raises(expected_exception): list(svc.stream("GET", url))