Skip to content
This repository has been archived by the owner on Oct 29, 2023. It is now read-only.

fix: Add async context manager return types #479

Merged
merged 2 commits into from Jul 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -2571,7 +2571,7 @@ async def sample_unbind_device_from_gateway():
# Done; return the response.
return response

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

async def __aexit__(self, exc_type, exc, tb):
Expand Down
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-iot",
"version": "2.9.1"
"version": "0.1.0"
},
"snippets": [
{
Expand Down
12 changes: 8 additions & 4 deletions tests/unit/gapic/iot_v1/test_device_manager.py
Expand Up @@ -2168,9 +2168,11 @@ async def test_list_device_registries_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_device_registries(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 @@ -3560,9 +3562,11 @@ async def test_list_devices_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_devices(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