Skip to content

Commit

Permalink
chore: Update gapic-generator-python to v1.18.5 (#521)
Browse files Browse the repository at this point in the history
* chore: Update gapic-generator-python to v1.18.5

PiperOrigin-RevId: 661268868

Source-Link: googleapis/googleapis@f7d214c

Source-Link: googleapis/googleapis-gen@79a8411
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNzlhODQxMWJiZGIyNWE5ODNmYTNhYWU4YzBlMTQzMjdkZjEyOWY5NCJ9

* 🦉 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] authored Aug 26, 2024
1 parent 8e661d7 commit 436a211
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# limitations under the License.
#
from collections import OrderedDict
import functools
import re
from typing import (
Dict,
Expand Down Expand Up @@ -189,9 +188,7 @@ def universe_domain(self) -> str:
"""
return self._client._universe_domain

get_transport_class = functools.partial(
type(ErrorGroupServiceClient).get_transport_class, type(ErrorGroupServiceClient)
)
get_transport_class = ErrorGroupServiceClient.get_transport_class

def __init__(
self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ def __init__(
Type[ErrorGroupServiceTransport],
Callable[..., ErrorGroupServiceTransport],
] = (
type(self).get_transport_class(transport)
ErrorGroupServiceClient.get_transport_class(transport)
if isinstance(transport, str) or transport is None
else cast(Callable[..., ErrorGroupServiceTransport], transport)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# limitations under the License.
#
from collections import OrderedDict
import functools
import re
from typing import (
Dict,
Expand Down Expand Up @@ -192,9 +191,7 @@ def universe_domain(self) -> str:
"""
return self._client._universe_domain

get_transport_class = functools.partial(
type(ErrorStatsServiceClient).get_transport_class, type(ErrorStatsServiceClient)
)
get_transport_class = ErrorStatsServiceClient.get_transport_class

def __init__(
self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ def __init__(
Type[ErrorStatsServiceTransport],
Callable[..., ErrorStatsServiceTransport],
] = (
type(self).get_transport_class(transport)
ErrorStatsServiceClient.get_transport_class(transport)
if isinstance(transport, str) or transport is None
else cast(Callable[..., ErrorStatsServiceTransport], transport)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# limitations under the License.
#
from collections import OrderedDict
import functools
import re
from typing import (
Dict,
Expand Down Expand Up @@ -184,10 +183,7 @@ def universe_domain(self) -> str:
"""
return self._client._universe_domain

get_transport_class = functools.partial(
type(ReportErrorsServiceClient).get_transport_class,
type(ReportErrorsServiceClient),
)
get_transport_class = ReportErrorsServiceClient.get_transport_class

def __init__(
self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ def __init__(
Type[ReportErrorsServiceTransport],
Callable[..., ReportErrorsServiceTransport],
] = (
type(self).get_transport_class(transport)
ReportErrorsServiceClient.get_transport_class(transport)
if isinstance(transport, str) or transport is None
else cast(Callable[..., ReportErrorsServiceTransport], transport)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1330,22 +1330,23 @@ async def test_get_group_async_use_cached_wrapped_rpc(transport: str = "grpc_asy
)

# Replace cached wrapped function with mock
mock_object = mock.AsyncMock()
mock_rpc = mock.AsyncMock()
mock_rpc.return_value = mock.Mock()
client._client._transport._wrapped_methods[
client._client._transport.get_group
] = mock_object
] = mock_rpc

request = {}
await client.get_group(request)

# Establish that the underlying gRPC stub method was called.
assert mock_object.call_count == 1
assert mock_rpc.call_count == 1

await client.get_group(request)

# Establish that a new wrapper was not created for this call
assert wrapper_fn.call_count == 0
assert mock_object.call_count == 2
assert mock_rpc.call_count == 2


@pytest.mark.asyncio
Expand Down Expand Up @@ -1696,22 +1697,23 @@ async def test_update_group_async_use_cached_wrapped_rpc(
)

# Replace cached wrapped function with mock
mock_object = mock.AsyncMock()
mock_rpc = mock.AsyncMock()
mock_rpc.return_value = mock.Mock()
client._client._transport._wrapped_methods[
client._client._transport.update_group
] = mock_object
] = mock_rpc

request = {}
await client.update_group(request)

# Establish that the underlying gRPC stub method was called.
assert mock_object.call_count == 1
assert mock_rpc.call_count == 1

await client.update_group(request)

# Establish that a new wrapper was not created for this call
assert wrapper_fn.call_count == 0
assert mock_object.call_count == 2
assert mock_rpc.call_count == 2


@pytest.mark.asyncio
Expand Down
27 changes: 15 additions & 12 deletions tests/unit/gapic/errorreporting_v1beta1/test_error_stats_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -1333,22 +1333,23 @@ async def test_list_group_stats_async_use_cached_wrapped_rpc(
)

# Replace cached wrapped function with mock
mock_object = mock.AsyncMock()
mock_rpc = mock.AsyncMock()
mock_rpc.return_value = mock.Mock()
client._client._transport._wrapped_methods[
client._client._transport.list_group_stats
] = mock_object
] = mock_rpc

request = {}
await client.list_group_stats(request)

# Establish that the underlying gRPC stub method was called.
assert mock_object.call_count == 1
assert mock_rpc.call_count == 1

await client.list_group_stats(request)

# Establish that a new wrapper was not created for this call
assert wrapper_fn.call_count == 0
assert mock_object.call_count == 2
assert mock_rpc.call_count == 2


@pytest.mark.asyncio
Expand Down Expand Up @@ -1920,22 +1921,23 @@ async def test_list_events_async_use_cached_wrapped_rpc(
)

# Replace cached wrapped function with mock
mock_object = mock.AsyncMock()
mock_rpc = mock.AsyncMock()
mock_rpc.return_value = mock.Mock()
client._client._transport._wrapped_methods[
client._client._transport.list_events
] = mock_object
] = mock_rpc

request = {}
await client.list_events(request)

# Establish that the underlying gRPC stub method was called.
assert mock_object.call_count == 1
assert mock_rpc.call_count == 1

await client.list_events(request)

# Establish that a new wrapper was not created for this call
assert wrapper_fn.call_count == 0
assert mock_object.call_count == 2
assert mock_rpc.call_count == 2


@pytest.mark.asyncio
Expand Down Expand Up @@ -2483,22 +2485,23 @@ async def test_delete_events_async_use_cached_wrapped_rpc(
)

# Replace cached wrapped function with mock
mock_object = mock.AsyncMock()
mock_rpc = mock.AsyncMock()
mock_rpc.return_value = mock.Mock()
client._client._transport._wrapped_methods[
client._client._transport.delete_events
] = mock_object
] = mock_rpc

request = {}
await client.delete_events(request)

# Establish that the underlying gRPC stub method was called.
assert mock_object.call_count == 1
assert mock_rpc.call_count == 1

await client.delete_events(request)

# Establish that a new wrapper was not created for this call
assert wrapper_fn.call_count == 0
assert mock_object.call_count == 2
assert mock_rpc.call_count == 2


@pytest.mark.asyncio
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1366,22 +1366,23 @@ async def test_report_error_event_async_use_cached_wrapped_rpc(
)

# Replace cached wrapped function with mock
mock_object = mock.AsyncMock()
mock_rpc = mock.AsyncMock()
mock_rpc.return_value = mock.Mock()
client._client._transport._wrapped_methods[
client._client._transport.report_error_event
] = mock_object
] = mock_rpc

request = {}
await client.report_error_event(request)

# Establish that the underlying gRPC stub method was called.
assert mock_object.call_count == 1
assert mock_rpc.call_count == 1

await client.report_error_event(request)

# Establish that a new wrapper was not created for this call
assert wrapper_fn.call_count == 0
assert mock_object.call_count == 2
assert mock_rpc.call_count == 2


@pytest.mark.asyncio
Expand Down

0 comments on commit 436a211

Please sign in to comment.