This repository was archived by the owner on Feb 23, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3131 pytest .skip ("No GRPC" , allow_module_level = True )
3232
3333from google .api_core import bidi_async
34+ from google .api_core import exceptions
3435
3536
3637if sys .version_info < (3 , 10 ): # type: ignore[operator]
@@ -222,6 +223,23 @@ async def test_open_error_already_open(self):
222223 with pytest .raises (ValueError ):
223224 await bidi_rpc .open ()
224225
226+ @pytest .mark .asyncio
227+ async def test_open_error_call_error (self ):
228+ rpc , _ = make_async_rpc ()
229+ expected_exception = exceptions .GoogleAPICallError (
230+ "test" , response = mock .sentinel .response
231+ )
232+ rpc .side_effect = expected_exception
233+ bidi_rpc = bidi_async .AsyncBidiRpc (rpc )
234+ callback = mock .Mock (spec = ["__call__" ])
235+ bidi_rpc .add_done_callback (callback )
236+
237+ with pytest .raises (exceptions .GoogleAPICallError ) as exc_info :
238+ await bidi_rpc .open ()
239+
240+ assert exc_info .value == expected_exception
241+ callback .assert_called_once_with (mock .sentinel .response )
242+
225243 @pytest .mark .asyncio
226244 async def test_close (self ):
227245 rpc , call = make_async_rpc ()
You can’t perform that action at this time.
0 commit comments