Skip to content
This repository was archived by the owner on Apr 20, 2024. It is now read-only.

Commit b816f38

Browse files
chore: use gapic-generator-python 0.58.4 (#297)
* chore: use gapic-generator-python 0.58.4 fix: provide appropriate mock values for message body fields committer: dovs PiperOrigin-RevId: 419025932 Source-Link: googleapis/googleapis@73da669 Source-Link: https://github.com/googleapis/googleapis-gen/commit/46df624a54b9ed47c1a7eefb7a49413cf7b82f98 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNDZkZjYyNGE1NGI5ZWQ0N2MxYTdlZWZiN2E0OTQxM2NmN2I4MmY5OCJ9 * 🦉 Updates from OwlBot 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 fabc7ae commit b816f38

File tree

6 files changed

+97
-144
lines changed

6 files changed

+97
-144
lines changed

google/cloud/speech_v1/services/speech/transports/base.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ def __init__(
101101
credentials, _ = google.auth.load_credentials_from_file(
102102
credentials_file, **scopes_kwargs, quota_project_id=quota_project_id
103103
)
104-
105104
elif credentials is None:
106105
credentials, _ = google.auth.default(
107106
**scopes_kwargs, quota_project_id=quota_project_id

google/cloud/speech_v1p1beta1/services/adaptation/transports/base.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ def __init__(
101101
credentials, _ = google.auth.load_credentials_from_file(
102102
credentials_file, **scopes_kwargs, quota_project_id=quota_project_id
103103
)
104-
105104
elif credentials is None:
106105
credentials, _ = google.auth.default(
107106
**scopes_kwargs, quota_project_id=quota_project_id

google/cloud/speech_v1p1beta1/services/speech/transports/base.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ def __init__(
101101
credentials, _ = google.auth.load_credentials_from_file(
102102
credentials_file, **scopes_kwargs, quota_project_id=quota_project_id
103103
)
104-
105104
elif credentials is None:
106105
credentials, _ = google.auth.default(
107106
**scopes_kwargs, quota_project_id=quota_project_id

tests/unit/gapic/speech_v1/test_speech.py

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -231,20 +231,20 @@ def test_speech_client_client_options(client_class, transport_class, transport_n
231231
# unsupported value.
232232
with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}):
233233
with pytest.raises(MutualTLSChannelError):
234-
client = client_class()
234+
client = client_class(transport=transport_name)
235235

236236
# Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value.
237237
with mock.patch.dict(
238238
os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"}
239239
):
240240
with pytest.raises(ValueError):
241-
client = client_class()
241+
client = client_class(transport=transport_name)
242242

243243
# Check the case quota_project_id is provided
244244
options = client_options.ClientOptions(quota_project_id="octopus")
245245
with mock.patch.object(transport_class, "__init__") as patched:
246246
patched.return_value = None
247-
client = client_class(transport=transport_name, client_options=options)
247+
client = client_class(client_options=options, transport=transport_name)
248248
patched.assert_called_once_with(
249249
credentials=None,
250250
credentials_file=None,
@@ -299,7 +299,7 @@ def test_speech_client_mtls_env_auto(
299299
)
300300
with mock.patch.object(transport_class, "__init__") as patched:
301301
patched.return_value = None
302-
client = client_class(transport=transport_name, client_options=options)
302+
client = client_class(client_options=options, transport=transport_name)
303303

304304
if use_client_cert_env == "false":
305305
expected_client_cert_source = None
@@ -390,7 +390,7 @@ def test_speech_client_client_options_scopes(
390390
options = client_options.ClientOptions(scopes=["1", "2"],)
391391
with mock.patch.object(transport_class, "__init__") as patched:
392392
patched.return_value = None
393-
client = client_class(transport=transport_name, client_options=options)
393+
client = client_class(client_options=options, transport=transport_name)
394394
patched.assert_called_once_with(
395395
credentials=None,
396396
credentials_file=None,
@@ -417,7 +417,7 @@ def test_speech_client_client_options_credentials_file(
417417
options = client_options.ClientOptions(credentials_file="credentials.json")
418418
with mock.patch.object(transport_class, "__init__") as patched:
419419
patched.return_value = None
420-
client = client_class(transport=transport_name, client_options=options)
420+
client = client_class(client_options=options, transport=transport_name)
421421
patched.assert_called_once_with(
422422
credentials=None,
423423
credentials_file="credentials.json",
@@ -448,7 +448,8 @@ def test_speech_client_client_options_from_dict():
448448
)
449449

450450

451-
def test_recognize(transport: str = "grpc", request_type=cloud_speech.RecognizeRequest):
451+
@pytest.mark.parametrize("request_type", [cloud_speech.RecognizeRequest, dict,])
452+
def test_recognize(request_type, transport: str = "grpc"):
452453
client = SpeechClient(
453454
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
454455
)
@@ -472,10 +473,6 @@ def test_recognize(transport: str = "grpc", request_type=cloud_speech.RecognizeR
472473
assert isinstance(response, cloud_speech.RecognizeResponse)
473474

474475

475-
def test_recognize_from_dict():
476-
test_recognize(request_type=dict)
477-
478-
479476
def test_recognize_empty_call():
480477
# This test is a coverage failsafe to make sure that totally empty calls,
481478
# i.e. request == None and no flattened fields passed, work.
@@ -621,9 +618,10 @@ async def test_recognize_flattened_error_async():
621618
)
622619

623620

624-
def test_long_running_recognize(
625-
transport: str = "grpc", request_type=cloud_speech.LongRunningRecognizeRequest
626-
):
621+
@pytest.mark.parametrize(
622+
"request_type", [cloud_speech.LongRunningRecognizeRequest, dict,]
623+
)
624+
def test_long_running_recognize(request_type, transport: str = "grpc"):
627625
client = SpeechClient(
628626
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
629627
)
@@ -649,10 +647,6 @@ def test_long_running_recognize(
649647
assert isinstance(response, future.Future)
650648

651649

652-
def test_long_running_recognize_from_dict():
653-
test_long_running_recognize(request_type=dict)
654-
655-
656650
def test_long_running_recognize_empty_call():
657651
# This test is a coverage failsafe to make sure that totally empty calls,
658652
# i.e. request == None and no flattened fields passed, work.
@@ -807,9 +801,10 @@ async def test_long_running_recognize_flattened_error_async():
807801
)
808802

809803

810-
def test_streaming_recognize(
811-
transport: str = "grpc", request_type=cloud_speech.StreamingRecognizeRequest
812-
):
804+
@pytest.mark.parametrize(
805+
"request_type", [cloud_speech.StreamingRecognizeRequest, dict,]
806+
)
807+
def test_streaming_recognize(request_type, transport: str = "grpc"):
813808
client = SpeechClient(
814809
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
815810
)
@@ -837,10 +832,6 @@ def test_streaming_recognize(
837832
assert isinstance(message, cloud_speech.StreamingRecognizeResponse)
838833

839834

840-
def test_streaming_recognize_from_dict():
841-
test_streaming_recognize(request_type=dict)
842-
843-
844835
@pytest.mark.asyncio
845836
async def test_streaming_recognize_async(
846837
transport: str = "grpc_asyncio", request_type=cloud_speech.StreamingRecognizeRequest
@@ -1434,7 +1425,7 @@ def test_parse_common_location_path():
14341425
assert expected == actual
14351426

14361427

1437-
def test_client_withDEFAULT_CLIENT_INFO():
1428+
def test_client_with_default_client_info():
14381429
client_info = gapic_v1.client_info.ClientInfo()
14391430

14401431
with mock.patch.object(

0 commit comments

Comments
 (0)