diff --git a/gapic/templates/%namespace/%name_%version/%sub/services/%service/async_client.py.j2 b/gapic/templates/%namespace/%name_%version/%sub/services/%service/async_client.py.j2 index 88b142dd60..25b6a33731 100644 --- a/gapic/templates/%namespace/%name_%version/%sub/services/%service/async_client.py.j2 +++ b/gapic/templates/%namespace/%name_%version/%sub/services/%service/async_client.py.j2 @@ -192,7 +192,7 @@ class {{ service.async_client_name }}: {% for method in service.methods.values() %} {% with method_name = method.safe_name|snake_case + "_unary" if method.operation_service else method.safe_name|snake_case %} - {%+ if not method.server_streaming %}async {% endif %}def {{ method_name }}(self, + async def {{ method_name }}(self, {% endwith %} {% if not method.client_streaming %} request: Optional[Union[{{ method.input.ident }}, dict]] = None, @@ -343,7 +343,7 @@ class {{ service.async_client_name }}: # Send the request. {%+ if not method.void %}response = {% endif %} - {% if not method.server_streaming %}await {% endif %}rpc( +rpc( {% if not method.client_streaming %} request, {% else %} diff --git a/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_macros.j2 b/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_macros.j2 index a76c758334..ec00d25ae3 100644 --- a/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_macros.j2 +++ b/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_macros.j2 @@ -183,6 +183,7 @@ async def test_{{ method_name }}_async(transport: str = 'grpc_asyncio', request_ message = await response.read() assert isinstance(message, {{ method.output.ident }}) {% else %} + response = await response assert isinstance(response, {{ method.client_output_async.ident }}) {% for field in method_output.fields.values() | rejectattr('message') %} {% if not field.oneof or field.proto3_optional %}