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

Commit 98df6ad

Browse files
fix: Add async context manager return types (#362)
* 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: https://github.com/googleapis/googleapis-gen/commit/b3f18d0f6560a855022fd058865e7620479d7af9 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>
1 parent 1b50941 commit 98df6ad

File tree

3 files changed

+22
-12
lines changed

3 files changed

+22
-12
lines changed

google/cloud/bigquery_reservation_v1/services/reservation_service/async_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2922,7 +2922,7 @@ async def sample_update_bi_reservation():
29222922
# Done; return the response.
29232923
return response
29242924

2925-
async def __aenter__(self):
2925+
async def __aenter__(self) -> "ReservationServiceAsyncClient":
29262926
return self
29272927

29282928
async def __aexit__(self, exc_type, exc, tb):

samples/generated_samples/snippet_metadata_google.cloud.bigquery.reservation.v1.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
],
99
"language": "PYTHON",
1010
"name": "google-cloud-bigquery-reservation",
11-
"version": "1.11.1"
11+
"version": "0.1.0"
1212
},
1313
"snippets": [
1414
{

tests/unit/gapic/bigquery_reservation_v1/test_reservation_service.py

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1461,9 +1461,11 @@ async def test_list_reservations_async_pages():
14611461
RuntimeError,
14621462
)
14631463
pages = []
1464-
async for page_ in (
1464+
# Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch`
1465+
# See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372
1466+
async for page_ in ( # pragma: no branch
14651467
await client.list_reservations(request={})
1466-
).pages: # pragma: no branch
1468+
).pages:
14671469
pages.append(page_)
14681470
for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
14691471
assert page_.raw_page.next_page_token == token
@@ -2948,9 +2950,11 @@ async def test_list_capacity_commitments_async_pages():
29482950
RuntimeError,
29492951
)
29502952
pages = []
2951-
async for page_ in (
2953+
# Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch`
2954+
# See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372
2955+
async for page_ in ( # pragma: no branch
29522956
await client.list_capacity_commitments(request={})
2953-
).pages: # pragma: no branch
2957+
).pages:
29542958
pages.append(page_)
29552959
for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
29562960
assert page_.raw_page.next_page_token == token
@@ -4955,9 +4959,11 @@ async def test_list_assignments_async_pages():
49554959
RuntimeError,
49564960
)
49574961
pages = []
4958-
async for page_ in (
4962+
# Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch`
4963+
# See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372
4964+
async for page_ in ( # pragma: no branch
49594965
await client.list_assignments(request={})
4960-
).pages: # pragma: no branch
4966+
).pages:
49614967
pages.append(page_)
49624968
for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
49634969
assert page_.raw_page.next_page_token == token
@@ -5641,9 +5647,11 @@ async def test_search_assignments_async_pages():
56415647
RuntimeError,
56425648
)
56435649
pages = []
5644-
async for page_ in (
5650+
# Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch`
5651+
# See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372
5652+
async for page_ in ( # pragma: no branch
56455653
await client.search_assignments(request={})
5646-
).pages: # pragma: no branch
5654+
).pages:
56475655
pages.append(page_)
56485656
for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
56495657
assert page_.raw_page.next_page_token == token
@@ -6094,9 +6102,11 @@ async def test_search_all_assignments_async_pages():
60946102
RuntimeError,
60956103
)
60966104
pages = []
6097-
async for page_ in (
6105+
# Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch`
6106+
# See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372
6107+
async for page_ in ( # pragma: no branch
60986108
await client.search_all_assignments(request={})
6099-
).pages: # pragma: no branch
6109+
).pages:
61006110
pages.append(page_)
61016111
for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
61026112
assert page_.raw_page.next_page_token == token

0 commit comments

Comments
 (0)