Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
fix: Add async context manager return types (#496)
Browse files Browse the repository at this point in the history
* fix: Add async context manager return types

chore: Mock return_value should not populate oneof message fields

chore: Support snippet generation for services that only support REST transport

chore: Update gapic-generator-python to v1.11.0
PiperOrigin-RevId: 545430278

Source-Link: googleapis/googleapis@601b532

Source-Link: googleapis/googleapis-gen@b3f18d0
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjNmMThkMGY2NTYwYTg1NTAyMmZkMDU4ODY1ZTc2MjA0NzlkN2FmOSJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] committed Jul 4, 2023
1 parent 2516229 commit 528a91d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1645,7 +1645,7 @@ async def sample_delete_glossary():
# Done; return the response.
return response

async def __aenter__(self):
async def __aenter__(self) -> "TranslationServiceAsyncClient":
return self

async def __aexit__(self, exc_type, exc, tb):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1551,7 +1551,7 @@ async def sample_delete_glossary():
# Done; return the response.
return response

async def __aenter__(self):
async def __aenter__(self) -> "TranslationServiceAsyncClient":
return self

async def __aexit__(self, exc_type, exc, tb):
Expand Down
12 changes: 4 additions & 8 deletions tests/unit/gapic/translate_v3/test_translation_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -2841,9 +2841,11 @@ async def test_list_glossaries_async_pages():
RuntimeError,
)
pages = []
async for page_ in (
# Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch`
# See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372
async for page_ in ( # pragma: no branch
await client.list_glossaries(request={})
).pages: # pragma: no branch
).pages:
pages.append(page_)
for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
assert page_.raw_page.next_page_token == token
Expand Down Expand Up @@ -2873,9 +2875,6 @@ def test_get_glossary(request_type, transport: str = "grpc"):
name="name_value",
entry_count=1210,
display_name="display_name_value",
language_pair=translation_service.Glossary.LanguageCodePair(
source_language_code="source_language_code_value"
),
)
response = client.get_glossary(request)

Expand Down Expand Up @@ -5610,9 +5609,6 @@ def test_get_glossary_rest(request_type):
name="name_value",
entry_count=1210,
display_name="display_name_value",
language_pair=translation_service.Glossary.LanguageCodePair(
source_language_code="source_language_code_value"
),
)

# Wrap the value into a proper Response obj
Expand Down
12 changes: 4 additions & 8 deletions tests/unit/gapic/translate_v3beta1/test_translation_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -2713,9 +2713,11 @@ async def test_list_glossaries_async_pages():
RuntimeError,
)
pages = []
async for page_ in (
# Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch`
# See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372
async for page_ in ( # pragma: no branch
await client.list_glossaries(request={})
).pages: # pragma: no branch
).pages:
pages.append(page_)
for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
assert page_.raw_page.next_page_token == token
Expand Down Expand Up @@ -2744,9 +2746,6 @@ def test_get_glossary(request_type, transport: str = "grpc"):
call.return_value = translation_service.Glossary(
name="name_value",
entry_count=1210,
language_pair=translation_service.Glossary.LanguageCodePair(
source_language_code="source_language_code_value"
),
)
response = client.get_glossary(request)

Expand Down Expand Up @@ -5412,9 +5411,6 @@ def test_get_glossary_rest(request_type):
return_value = translation_service.Glossary(
name="name_value",
entry_count=1210,
language_pair=translation_service.Glossary.LanguageCodePair(
source_language_code="source_language_code_value"
),
)

# Wrap the value into a proper Response obj
Expand Down

0 comments on commit 528a91d

Please sign in to comment.