Skip to content

Commit 854122a

Browse files
chore: use gapic-generator-python 0.58.4 (#284)
* 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: googleapis/googleapis-gen@46df624 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNDZkZjYyNGE1NGI5ZWQ0N2MxYTdlZWZiN2E0OTQxM2NmN2I4MmY5OCJ9 * 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: googleapis/googleapis-gen@46df624 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNDZkZjYyNGE1NGI5ZWQ0N2MxYTdlZWZiN2E0OTQxM2NmN2I4MmY5OCJ9 * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 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 a3773dc commit 854122a

File tree

16 files changed

+428
-621
lines changed

16 files changed

+428
-621
lines changed

packages/google-cloud-vision/google/cloud/vision_v1/services/image_annotator/transports/base.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ def __init__(
104104
credentials, _ = google.auth.load_credentials_from_file(
105105
credentials_file, **scopes_kwargs, quota_project_id=quota_project_id
106106
)
107-
108107
elif credentials is None:
109108
credentials, _ = google.auth.default(
110109
**scopes_kwargs, quota_project_id=quota_project_id

packages/google-cloud-vision/google/cloud/vision_v1/services/product_search/transports/base.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ def __init__(
105105
credentials, _ = google.auth.load_credentials_from_file(
106106
credentials_file, **scopes_kwargs, quota_project_id=quota_project_id
107107
)
108-
109108
elif credentials is None:
110109
credentials, _ = google.auth.default(
111110
**scopes_kwargs, quota_project_id=quota_project_id

packages/google-cloud-vision/google/cloud/vision_v1p1beta1/services/image_annotator/transports/base.py

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

packages/google-cloud-vision/google/cloud/vision_v1p2beta1/services/image_annotator/transports/base.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ def __init__(
104104
credentials, _ = google.auth.load_credentials_from_file(
105105
credentials_file, **scopes_kwargs, quota_project_id=quota_project_id
106106
)
107-
108107
elif credentials is None:
109108
credentials, _ = google.auth.default(
110109
**scopes_kwargs, quota_project_id=quota_project_id

packages/google-cloud-vision/google/cloud/vision_v1p3beta1/services/image_annotator/transports/base.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ def __init__(
104104
credentials, _ = google.auth.load_credentials_from_file(
105105
credentials_file, **scopes_kwargs, quota_project_id=quota_project_id
106106
)
107-
108107
elif credentials is None:
109108
credentials, _ = google.auth.default(
110109
**scopes_kwargs, quota_project_id=quota_project_id

packages/google-cloud-vision/google/cloud/vision_v1p3beta1/services/product_search/transports/base.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ def __init__(
105105
credentials, _ = google.auth.load_credentials_from_file(
106106
credentials_file, **scopes_kwargs, quota_project_id=quota_project_id
107107
)
108-
109108
elif credentials is None:
110109
credentials, _ = google.auth.default(
111110
**scopes_kwargs, quota_project_id=quota_project_id

packages/google-cloud-vision/google/cloud/vision_v1p4beta1/services/image_annotator/transports/base.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ def __init__(
104104
credentials, _ = google.auth.load_credentials_from_file(
105105
credentials_file, **scopes_kwargs, quota_project_id=quota_project_id
106106
)
107-
108107
elif credentials is None:
109108
credentials, _ = google.auth.default(
110109
**scopes_kwargs, quota_project_id=quota_project_id

packages/google-cloud-vision/google/cloud/vision_v1p4beta1/services/product_search/transports/base.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ def __init__(
105105
credentials, _ = google.auth.load_credentials_from_file(
106106
credentials_file, **scopes_kwargs, quota_project_id=quota_project_id
107107
)
108-
109108
elif credentials is None:
110109
credentials, _ = google.auth.default(
111110
**scopes_kwargs, quota_project_id=quota_project_id

packages/google-cloud-vision/tests/unit/gapic/vision_v1/test_image_annotator.py

Lines changed: 23 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -252,20 +252,20 @@ def test_image_annotator_client_client_options(
252252
# unsupported value.
253253
with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}):
254254
with pytest.raises(MutualTLSChannelError):
255-
client = client_class()
255+
client = client_class(transport=transport_name)
256256

257257
# Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value.
258258
with mock.patch.dict(
259259
os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"}
260260
):
261261
with pytest.raises(ValueError):
262-
client = client_class()
262+
client = client_class(transport=transport_name)
263263

264264
# Check the case quota_project_id is provided
265265
options = client_options.ClientOptions(quota_project_id="octopus")
266266
with mock.patch.object(transport_class, "__init__") as patched:
267267
patched.return_value = None
268-
client = client_class(transport=transport_name, client_options=options)
268+
client = client_class(client_options=options, transport=transport_name)
269269
patched.assert_called_once_with(
270270
credentials=None,
271271
credentials_file=None,
@@ -324,7 +324,7 @@ def test_image_annotator_client_mtls_env_auto(
324324
)
325325
with mock.patch.object(transport_class, "__init__") as patched:
326326
patched.return_value = None
327-
client = client_class(transport=transport_name, client_options=options)
327+
client = client_class(client_options=options, transport=transport_name)
328328

329329
if use_client_cert_env == "false":
330330
expected_client_cert_source = None
@@ -419,7 +419,7 @@ def test_image_annotator_client_client_options_scopes(
419419
options = client_options.ClientOptions(scopes=["1", "2"],)
420420
with mock.patch.object(transport_class, "__init__") as patched:
421421
patched.return_value = None
422-
client = client_class(transport=transport_name, client_options=options)
422+
client = client_class(client_options=options, transport=transport_name)
423423
patched.assert_called_once_with(
424424
credentials=None,
425425
credentials_file=None,
@@ -450,7 +450,7 @@ def test_image_annotator_client_client_options_credentials_file(
450450
options = client_options.ClientOptions(credentials_file="credentials.json")
451451
with mock.patch.object(transport_class, "__init__") as patched:
452452
patched.return_value = None
453-
client = client_class(transport=transport_name, client_options=options)
453+
client = client_class(client_options=options, transport=transport_name)
454454
patched.assert_called_once_with(
455455
credentials=None,
456456
credentials_file="credentials.json",
@@ -483,9 +483,10 @@ def test_image_annotator_client_client_options_from_dict():
483483
)
484484

485485

486-
def test_batch_annotate_images(
487-
transport: str = "grpc", request_type=image_annotator.BatchAnnotateImagesRequest
488-
):
486+
@pytest.mark.parametrize(
487+
"request_type", [image_annotator.BatchAnnotateImagesRequest, dict,]
488+
)
489+
def test_batch_annotate_images(request_type, transport: str = "grpc"):
489490
client = ImageAnnotatorClient(
490491
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
491492
)
@@ -511,10 +512,6 @@ def test_batch_annotate_images(
511512
assert isinstance(response, image_annotator.BatchAnnotateImagesResponse)
512513

513514

514-
def test_batch_annotate_images_from_dict():
515-
test_batch_annotate_images(request_type=dict)
516-
517-
518515
def test_batch_annotate_images_empty_call():
519516
# This test is a coverage failsafe to make sure that totally empty calls,
520517
# i.e. request == None and no flattened fields passed, work.
@@ -675,9 +672,10 @@ async def test_batch_annotate_images_flattened_error_async():
675672
)
676673

677674

678-
def test_batch_annotate_files(
679-
transport: str = "grpc", request_type=image_annotator.BatchAnnotateFilesRequest
680-
):
675+
@pytest.mark.parametrize(
676+
"request_type", [image_annotator.BatchAnnotateFilesRequest, dict,]
677+
)
678+
def test_batch_annotate_files(request_type, transport: str = "grpc"):
681679
client = ImageAnnotatorClient(
682680
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
683681
)
@@ -703,10 +701,6 @@ def test_batch_annotate_files(
703701
assert isinstance(response, image_annotator.BatchAnnotateFilesResponse)
704702

705703

706-
def test_batch_annotate_files_from_dict():
707-
test_batch_annotate_files(request_type=dict)
708-
709-
710704
def test_batch_annotate_files_empty_call():
711705
# This test is a coverage failsafe to make sure that totally empty calls,
712706
# i.e. request == None and no flattened fields passed, work.
@@ -879,10 +873,10 @@ async def test_batch_annotate_files_flattened_error_async():
879873
)
880874

881875

882-
def test_async_batch_annotate_images(
883-
transport: str = "grpc",
884-
request_type=image_annotator.AsyncBatchAnnotateImagesRequest,
885-
):
876+
@pytest.mark.parametrize(
877+
"request_type", [image_annotator.AsyncBatchAnnotateImagesRequest, dict,]
878+
)
879+
def test_async_batch_annotate_images(request_type, transport: str = "grpc"):
886880
client = ImageAnnotatorClient(
887881
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
888882
)
@@ -908,10 +902,6 @@ def test_async_batch_annotate_images(
908902
assert isinstance(response, future.Future)
909903

910904

911-
def test_async_batch_annotate_images_from_dict():
912-
test_async_batch_annotate_images(request_type=dict)
913-
914-
915905
def test_async_batch_annotate_images_empty_call():
916906
# This test is a coverage failsafe to make sure that totally empty calls,
917907
# i.e. request == None and no flattened fields passed, work.
@@ -1094,9 +1084,10 @@ async def test_async_batch_annotate_images_flattened_error_async():
10941084
)
10951085

10961086

1097-
def test_async_batch_annotate_files(
1098-
transport: str = "grpc", request_type=image_annotator.AsyncBatchAnnotateFilesRequest
1099-
):
1087+
@pytest.mark.parametrize(
1088+
"request_type", [image_annotator.AsyncBatchAnnotateFilesRequest, dict,]
1089+
)
1090+
def test_async_batch_annotate_files(request_type, transport: str = "grpc"):
11001091
client = ImageAnnotatorClient(
11011092
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
11021093
)
@@ -1122,10 +1113,6 @@ def test_async_batch_annotate_files(
11221113
assert isinstance(response, future.Future)
11231114

11241115

1125-
def test_async_batch_annotate_files_from_dict():
1126-
test_async_batch_annotate_files(request_type=dict)
1127-
1128-
11291116
def test_async_batch_annotate_files_empty_call():
11301117
# This test is a coverage failsafe to make sure that totally empty calls,
11311118
# i.e. request == None and no flattened fields passed, work.
@@ -1882,7 +1869,7 @@ def test_parse_common_location_path():
18821869
assert expected == actual
18831870

18841871

1885-
def test_client_withDEFAULT_CLIENT_INFO():
1872+
def test_client_with_default_client_info():
18861873
client_info = gapic_v1.client_info.ClientInfo()
18871874

18881875
with mock.patch.object(

0 commit comments

Comments
 (0)