@@ -1244,8 +1244,9 @@ def test_export_entities_use_cached_wrapped_rpc():
12441244 # Establish that the underlying gRPC stub method was called.
12451245 assert mock_rpc .call_count == 1
12461246
1247- # Operation methods build a cached wrapper on first rpc call
1248- # subsequent calls should use the cached wrapper
1247+ # Operation methods call wrapper_fn to build a cached
1248+ # client._transport.operations_client instance on first rpc call.
1249+ # Subsequent calls should use the cached wrapper
12491250 wrapper_fn .reset_mock ()
12501251
12511252 client .export_entities (request )
@@ -1299,26 +1300,28 @@ async def test_export_entities_async_use_cached_wrapped_rpc(
12991300 )
13001301
13011302 # Replace cached wrapped function with mock
1302- mock_object = mock .AsyncMock ()
1303+ mock_rpc = mock .AsyncMock ()
1304+ mock_rpc .return_value = mock .Mock ()
13031305 client ._client ._transport ._wrapped_methods [
13041306 client ._client ._transport .export_entities
1305- ] = mock_object
1307+ ] = mock_rpc
13061308
13071309 request = {}
13081310 await client .export_entities (request )
13091311
13101312 # Establish that the underlying gRPC stub method was called.
1311- assert mock_object .call_count == 1
1313+ assert mock_rpc .call_count == 1
13121314
1313- # Operation methods build a cached wrapper on first rpc call
1314- # subsequent calls should use the cached wrapper
1315+ # Operation methods call wrapper_fn to build a cached
1316+ # client._transport.operations_client instance on first rpc call.
1317+ # Subsequent calls should use the cached wrapper
13151318 wrapper_fn .reset_mock ()
13161319
13171320 await client .export_entities (request )
13181321
13191322 # Establish that a new wrapper was not created for this call
13201323 assert wrapper_fn .call_count == 0
1321- assert mock_object .call_count == 2
1324+ assert mock_rpc .call_count == 2
13221325
13231326
13241327@pytest .mark .asyncio
@@ -1640,8 +1643,9 @@ def test_import_entities_use_cached_wrapped_rpc():
16401643 # Establish that the underlying gRPC stub method was called.
16411644 assert mock_rpc .call_count == 1
16421645
1643- # Operation methods build a cached wrapper on first rpc call
1644- # subsequent calls should use the cached wrapper
1646+ # Operation methods call wrapper_fn to build a cached
1647+ # client._transport.operations_client instance on first rpc call.
1648+ # Subsequent calls should use the cached wrapper
16451649 wrapper_fn .reset_mock ()
16461650
16471651 client .import_entities (request )
@@ -1695,26 +1699,28 @@ async def test_import_entities_async_use_cached_wrapped_rpc(
16951699 )
16961700
16971701 # Replace cached wrapped function with mock
1698- mock_object = mock .AsyncMock ()
1702+ mock_rpc = mock .AsyncMock ()
1703+ mock_rpc .return_value = mock .Mock ()
16991704 client ._client ._transport ._wrapped_methods [
17001705 client ._client ._transport .import_entities
1701- ] = mock_object
1706+ ] = mock_rpc
17021707
17031708 request = {}
17041709 await client .import_entities (request )
17051710
17061711 # Establish that the underlying gRPC stub method was called.
1707- assert mock_object .call_count == 1
1712+ assert mock_rpc .call_count == 1
17081713
1709- # Operation methods build a cached wrapper on first rpc call
1710- # subsequent calls should use the cached wrapper
1714+ # Operation methods call wrapper_fn to build a cached
1715+ # client._transport.operations_client instance on first rpc call.
1716+ # Subsequent calls should use the cached wrapper
17111717 wrapper_fn .reset_mock ()
17121718
17131719 await client .import_entities (request )
17141720
17151721 # Establish that a new wrapper was not created for this call
17161722 assert wrapper_fn .call_count == 0
1717- assert mock_object .call_count == 2
1723+ assert mock_rpc .call_count == 2
17181724
17191725
17201726@pytest .mark .asyncio
@@ -2034,8 +2040,9 @@ def test_create_index_use_cached_wrapped_rpc():
20342040 # Establish that the underlying gRPC stub method was called.
20352041 assert mock_rpc .call_count == 1
20362042
2037- # Operation methods build a cached wrapper on first rpc call
2038- # subsequent calls should use the cached wrapper
2043+ # Operation methods call wrapper_fn to build a cached
2044+ # client._transport.operations_client instance on first rpc call.
2045+ # Subsequent calls should use the cached wrapper
20392046 wrapper_fn .reset_mock ()
20402047
20412048 client .create_index (request )
@@ -2089,26 +2096,28 @@ async def test_create_index_async_use_cached_wrapped_rpc(
20892096 )
20902097
20912098 # Replace cached wrapped function with mock
2092- mock_object = mock .AsyncMock ()
2099+ mock_rpc = mock .AsyncMock ()
2100+ mock_rpc .return_value = mock .Mock ()
20932101 client ._client ._transport ._wrapped_methods [
20942102 client ._client ._transport .create_index
2095- ] = mock_object
2103+ ] = mock_rpc
20962104
20972105 request = {}
20982106 await client .create_index (request )
20992107
21002108 # Establish that the underlying gRPC stub method was called.
2101- assert mock_object .call_count == 1
2109+ assert mock_rpc .call_count == 1
21022110
2103- # Operation methods build a cached wrapper on first rpc call
2104- # subsequent calls should use the cached wrapper
2111+ # Operation methods call wrapper_fn to build a cached
2112+ # client._transport.operations_client instance on first rpc call.
2113+ # Subsequent calls should use the cached wrapper
21052114 wrapper_fn .reset_mock ()
21062115
21072116 await client .create_index (request )
21082117
21092118 # Establish that a new wrapper was not created for this call
21102119 assert wrapper_fn .call_count == 0
2111- assert mock_object .call_count == 2
2120+ assert mock_rpc .call_count == 2
21122121
21132122
21142123@pytest .mark .asyncio
@@ -2318,8 +2327,9 @@ def test_delete_index_use_cached_wrapped_rpc():
23182327 # Establish that the underlying gRPC stub method was called.
23192328 assert mock_rpc .call_count == 1
23202329
2321- # Operation methods build a cached wrapper on first rpc call
2322- # subsequent calls should use the cached wrapper
2330+ # Operation methods call wrapper_fn to build a cached
2331+ # client._transport.operations_client instance on first rpc call.
2332+ # Subsequent calls should use the cached wrapper
23232333 wrapper_fn .reset_mock ()
23242334
23252335 client .delete_index (request )
@@ -2373,26 +2383,28 @@ async def test_delete_index_async_use_cached_wrapped_rpc(
23732383 )
23742384
23752385 # Replace cached wrapped function with mock
2376- mock_object = mock .AsyncMock ()
2386+ mock_rpc = mock .AsyncMock ()
2387+ mock_rpc .return_value = mock .Mock ()
23772388 client ._client ._transport ._wrapped_methods [
23782389 client ._client ._transport .delete_index
2379- ] = mock_object
2390+ ] = mock_rpc
23802391
23812392 request = {}
23822393 await client .delete_index (request )
23832394
23842395 # Establish that the underlying gRPC stub method was called.
2385- assert mock_object .call_count == 1
2396+ assert mock_rpc .call_count == 1
23862397
2387- # Operation methods build a cached wrapper on first rpc call
2388- # subsequent calls should use the cached wrapper
2398+ # Operation methods call wrapper_fn to build a cached
2399+ # client._transport.operations_client instance on first rpc call.
2400+ # Subsequent calls should use the cached wrapper
23892401 wrapper_fn .reset_mock ()
23902402
23912403 await client .delete_index (request )
23922404
23932405 # Establish that a new wrapper was not created for this call
23942406 assert wrapper_fn .call_count == 0
2395- assert mock_object .call_count == 2
2407+ assert mock_rpc .call_count == 2
23962408
23972409
23982410@pytest .mark .asyncio
@@ -2670,22 +2682,23 @@ async def test_get_index_async_use_cached_wrapped_rpc(transport: str = "grpc_asy
26702682 )
26712683
26722684 # Replace cached wrapped function with mock
2673- mock_object = mock .AsyncMock ()
2685+ mock_rpc = mock .AsyncMock ()
2686+ mock_rpc .return_value = mock .Mock ()
26742687 client ._client ._transport ._wrapped_methods [
26752688 client ._client ._transport .get_index
2676- ] = mock_object
2689+ ] = mock_rpc
26772690
26782691 request = {}
26792692 await client .get_index (request )
26802693
26812694 # Establish that the underlying gRPC stub method was called.
2682- assert mock_object .call_count == 1
2695+ assert mock_rpc .call_count == 1
26832696
26842697 await client .get_index (request )
26852698
26862699 # Establish that a new wrapper was not created for this call
26872700 assert wrapper_fn .call_count == 0
2688- assert mock_object .call_count == 2
2701+ assert mock_rpc .call_count == 2
26892702
26902703
26912704@pytest .mark .asyncio
@@ -2964,22 +2977,23 @@ async def test_list_indexes_async_use_cached_wrapped_rpc(
29642977 )
29652978
29662979 # Replace cached wrapped function with mock
2967- mock_object = mock .AsyncMock ()
2980+ mock_rpc = mock .AsyncMock ()
2981+ mock_rpc .return_value = mock .Mock ()
29682982 client ._client ._transport ._wrapped_methods [
29692983 client ._client ._transport .list_indexes
2970- ] = mock_object
2984+ ] = mock_rpc
29712985
29722986 request = {}
29732987 await client .list_indexes (request )
29742988
29752989 # Establish that the underlying gRPC stub method was called.
2976- assert mock_object .call_count == 1
2990+ assert mock_rpc .call_count == 1
29772991
29782992 await client .list_indexes (request )
29792993
29802994 # Establish that a new wrapper was not created for this call
29812995 assert wrapper_fn .call_count == 0
2982- assert mock_object .call_count == 2
2996+ assert mock_rpc .call_count == 2
29832997
29842998
29852999@pytest .mark .asyncio
0 commit comments