From 7987ddba83462465e13bfc23bb2f4e63bf526931 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 27 Apr 2022 09:43:45 -0400 Subject: [PATCH] chore: use gapic-generator-python 0.65.2 (#384) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: use gapic-generator-python 0.65.2 PiperOrigin-RevId: 444333013 Source-Link: https://github.com/googleapis/googleapis/commit/f91b6cf82e929280f6562f6110957c654bd9e2e6 Source-Link: https://github.com/googleapis/googleapis-gen/commit/16eb36095c294e712c74a1bf23550817b42174e5 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMTZlYjM2MDk1YzI5NGU3MTJjNzRhMWJmMjM1NTA4MTdiNDIxNzRlNSJ9 * 🦉 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 --- .../services/auto_ml/async_client.py | 108 +++++----- .../prediction_service/async_client.py | 12 +- .../services/auto_ml/async_client.py | 144 ++++++------- .../prediction_service/async_client.py | 12 +- .../unit/gapic/automl_v1/test_auto_ml.py | 150 ++++++------- .../automl_v1/test_prediction_service.py | 16 +- .../unit/gapic/automl_v1beta1/test_auto_ml.py | 202 +++++++++--------- .../automl_v1beta1/test_prediction_service.py | 16 +- 8 files changed, 330 insertions(+), 330 deletions(-) diff --git a/packages/google-cloud-automl/google/cloud/automl_v1/services/auto_ml/async_client.py b/packages/google-cloud-automl/google/cloud/automl_v1/services/auto_ml/async_client.py index c94c43ca358d..7a5dd3ab5733 100644 --- a/packages/google-cloud-automl/google/cloud/automl_v1/services/auto_ml/async_client.py +++ b/packages/google-cloud-automl/google/cloud/automl_v1/services/auto_ml/async_client.py @@ -249,9 +249,9 @@ async def create_dataset( from google.cloud import automl_v1 - def sample_create_dataset(): + async def sample_create_dataset(): # Create a client - client = automl_v1.AutoMlClient() + client = automl_v1.AutoMlAsyncClient() # Initialize request argument(s) dataset = automl_v1.Dataset() @@ -268,7 +268,7 @@ def sample_create_dataset(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -370,9 +370,9 @@ async def get_dataset( from google.cloud import automl_v1 - def sample_get_dataset(): + async def sample_get_dataset(): # Create a client - client = automl_v1.AutoMlClient() + client = automl_v1.AutoMlAsyncClient() # Initialize request argument(s) request = automl_v1.GetDatasetRequest( @@ -380,7 +380,7 @@ def sample_get_dataset(): ) # Make the request - response = client.get_dataset(request=request) + response = await client.get_dataset(request=request) # Handle the response print(response) @@ -477,9 +477,9 @@ async def list_datasets( from google.cloud import automl_v1 - def sample_list_datasets(): + async def sample_list_datasets(): # Create a client - client = automl_v1.AutoMlClient() + client = automl_v1.AutoMlAsyncClient() # Initialize request argument(s) request = automl_v1.ListDatasetsRequest( @@ -490,7 +490,7 @@ def sample_list_datasets(): page_result = client.list_datasets(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -596,9 +596,9 @@ async def update_dataset( from google.cloud import automl_v1 - def sample_update_dataset(): + async def sample_update_dataset(): # Create a client - client = automl_v1.AutoMlClient() + client = automl_v1.AutoMlAsyncClient() # Initialize request argument(s) dataset = automl_v1.Dataset() @@ -610,7 +610,7 @@ def sample_update_dataset(): ) # Make the request - response = client.update_dataset(request=request) + response = await client.update_dataset(request=request) # Handle the response print(response) @@ -712,9 +712,9 @@ async def delete_dataset( from google.cloud import automl_v1 - def sample_delete_dataset(): + async def sample_delete_dataset(): # Create a client - client = automl_v1.AutoMlClient() + client = automl_v1.AutoMlAsyncClient() # Initialize request argument(s) request = automl_v1.DeleteDatasetRequest( @@ -726,7 +726,7 @@ def sample_delete_dataset(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -852,9 +852,9 @@ async def import_data( from google.cloud import automl_v1 - def sample_import_data(): + async def sample_import_data(): # Create a client - client = automl_v1.AutoMlClient() + client = automl_v1.AutoMlAsyncClient() # Initialize request argument(s) input_config = automl_v1.InputConfig() @@ -870,7 +870,7 @@ def sample_import_data(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -991,9 +991,9 @@ async def export_data( from google.cloud import automl_v1 - def sample_export_data(): + async def sample_export_data(): # Create a client - client = automl_v1.AutoMlClient() + client = automl_v1.AutoMlAsyncClient() # Initialize request argument(s) output_config = automl_v1.OutputConfig() @@ -1009,7 +1009,7 @@ def sample_export_data(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -1124,9 +1124,9 @@ async def get_annotation_spec( from google.cloud import automl_v1 - def sample_get_annotation_spec(): + async def sample_get_annotation_spec(): # Create a client - client = automl_v1.AutoMlClient() + client = automl_v1.AutoMlAsyncClient() # Initialize request argument(s) request = automl_v1.GetAnnotationSpecRequest( @@ -1134,7 +1134,7 @@ def sample_get_annotation_spec(): ) # Make the request - response = client.get_annotation_spec(request=request) + response = await client.get_annotation_spec(request=request) # Handle the response print(response) @@ -1232,9 +1232,9 @@ async def create_model( from google.cloud import automl_v1 - def sample_create_model(): + async def sample_create_model(): # Create a client - client = automl_v1.AutoMlClient() + client = automl_v1.AutoMlAsyncClient() # Initialize request argument(s) request = automl_v1.CreateModelRequest( @@ -1246,7 +1246,7 @@ def sample_create_model(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -1350,9 +1350,9 @@ async def get_model( from google.cloud import automl_v1 - def sample_get_model(): + async def sample_get_model(): # Create a client - client = automl_v1.AutoMlClient() + client = automl_v1.AutoMlAsyncClient() # Initialize request argument(s) request = automl_v1.GetModelRequest( @@ -1360,7 +1360,7 @@ def sample_get_model(): ) # Make the request - response = client.get_model(request=request) + response = await client.get_model(request=request) # Handle the response print(response) @@ -1453,9 +1453,9 @@ async def list_models( from google.cloud import automl_v1 - def sample_list_models(): + async def sample_list_models(): # Create a client - client = automl_v1.AutoMlClient() + client = automl_v1.AutoMlAsyncClient() # Initialize request argument(s) request = automl_v1.ListModelsRequest( @@ -1466,7 +1466,7 @@ def sample_list_models(): page_result = client.list_models(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -1574,9 +1574,9 @@ async def delete_model( from google.cloud import automl_v1 - def sample_delete_model(): + async def sample_delete_model(): # Create a client - client = automl_v1.AutoMlClient() + client = automl_v1.AutoMlAsyncClient() # Initialize request argument(s) request = automl_v1.DeleteModelRequest( @@ -1588,7 +1588,7 @@ def sample_delete_model(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -1705,16 +1705,16 @@ async def update_model( from google.cloud import automl_v1 - def sample_update_model(): + async def sample_update_model(): # Create a client - client = automl_v1.AutoMlClient() + client = automl_v1.AutoMlAsyncClient() # Initialize request argument(s) request = automl_v1.UpdateModelRequest( ) # Make the request - response = client.update_model(request=request) + response = await client.update_model(request=request) # Handle the response print(response) @@ -1823,9 +1823,9 @@ async def deploy_model( from google.cloud import automl_v1 - def sample_deploy_model(): + async def sample_deploy_model(): # Create a client - client = automl_v1.AutoMlClient() + client = automl_v1.AutoMlAsyncClient() # Initialize request argument(s) request = automl_v1.DeployModelRequest( @@ -1837,7 +1837,7 @@ def sample_deploy_model(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -1951,9 +1951,9 @@ async def undeploy_model( from google.cloud import automl_v1 - def sample_undeploy_model(): + async def sample_undeploy_model(): # Create a client - client = automl_v1.AutoMlClient() + client = automl_v1.AutoMlAsyncClient() # Initialize request argument(s) request = automl_v1.UndeployModelRequest( @@ -1965,7 +1965,7 @@ def sample_undeploy_model(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -2079,9 +2079,9 @@ async def export_model( from google.cloud import automl_v1 - def sample_export_model(): + async def sample_export_model(): # Create a client - client = automl_v1.AutoMlClient() + client = automl_v1.AutoMlAsyncClient() # Initialize request argument(s) output_config = automl_v1.ModelExportOutputConfig() @@ -2097,7 +2097,7 @@ def sample_export_model(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -2214,9 +2214,9 @@ async def get_model_evaluation( from google.cloud import automl_v1 - def sample_get_model_evaluation(): + async def sample_get_model_evaluation(): # Create a client - client = automl_v1.AutoMlClient() + client = automl_v1.AutoMlAsyncClient() # Initialize request argument(s) request = automl_v1.GetModelEvaluationRequest( @@ -2224,7 +2224,7 @@ def sample_get_model_evaluation(): ) # Make the request - response = client.get_model_evaluation(request=request) + response = await client.get_model_evaluation(request=request) # Handle the response print(response) @@ -2318,9 +2318,9 @@ async def list_model_evaluations( from google.cloud import automl_v1 - def sample_list_model_evaluations(): + async def sample_list_model_evaluations(): # Create a client - client = automl_v1.AutoMlClient() + client = automl_v1.AutoMlAsyncClient() # Initialize request argument(s) request = automl_v1.ListModelEvaluationsRequest( @@ -2332,7 +2332,7 @@ def sample_list_model_evaluations(): page_result = client.list_model_evaluations(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: diff --git a/packages/google-cloud-automl/google/cloud/automl_v1/services/prediction_service/async_client.py b/packages/google-cloud-automl/google/cloud/automl_v1/services/prediction_service/async_client.py index 0b503af975cb..eb4890494255 100644 --- a/packages/google-cloud-automl/google/cloud/automl_v1/services/prediction_service/async_client.py +++ b/packages/google-cloud-automl/google/cloud/automl_v1/services/prediction_service/async_client.py @@ -264,9 +264,9 @@ async def predict( from google.cloud import automl_v1 - def sample_predict(): + async def sample_predict(): # Create a client - client = automl_v1.PredictionServiceClient() + client = automl_v1.PredictionServiceAsyncClient() # Initialize request argument(s) payload = automl_v1.ExamplePayload() @@ -278,7 +278,7 @@ def sample_predict(): ) # Make the request - response = client.predict(request=request) + response = await client.predict(request=request) # Handle the response print(response) @@ -433,9 +433,9 @@ async def batch_predict( from google.cloud import automl_v1 - def sample_batch_predict(): + async def sample_batch_predict(): # Create a client - client = automl_v1.PredictionServiceClient() + client = automl_v1.PredictionServiceAsyncClient() # Initialize request argument(s) input_config = automl_v1.BatchPredictInputConfig() @@ -455,7 +455,7 @@ def sample_batch_predict(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) diff --git a/packages/google-cloud-automl/google/cloud/automl_v1beta1/services/auto_ml/async_client.py b/packages/google-cloud-automl/google/cloud/automl_v1beta1/services/auto_ml/async_client.py index 43eef6d19bd8..781235a2435f 100644 --- a/packages/google-cloud-automl/google/cloud/automl_v1beta1/services/auto_ml/async_client.py +++ b/packages/google-cloud-automl/google/cloud/automl_v1beta1/services/auto_ml/async_client.py @@ -261,9 +261,9 @@ async def create_dataset( from google.cloud import automl_v1beta1 - def sample_create_dataset(): + async def sample_create_dataset(): # Create a client - client = automl_v1beta1.AutoMlClient() + client = automl_v1beta1.AutoMlAsyncClient() # Initialize request argument(s) dataset = automl_v1beta1.Dataset() @@ -276,7 +276,7 @@ def sample_create_dataset(): ) # Make the request - response = client.create_dataset(request=request) + response = await client.create_dataset(request=request) # Handle the response print(response) @@ -370,9 +370,9 @@ async def get_dataset( from google.cloud import automl_v1beta1 - def sample_get_dataset(): + async def sample_get_dataset(): # Create a client - client = automl_v1beta1.AutoMlClient() + client = automl_v1beta1.AutoMlAsyncClient() # Initialize request argument(s) request = automl_v1beta1.GetDatasetRequest( @@ -380,7 +380,7 @@ def sample_get_dataset(): ) # Make the request - response = client.get_dataset(request=request) + response = await client.get_dataset(request=request) # Handle the response print(response) @@ -477,9 +477,9 @@ async def list_datasets( from google.cloud import automl_v1beta1 - def sample_list_datasets(): + async def sample_list_datasets(): # Create a client - client = automl_v1beta1.AutoMlClient() + client = automl_v1beta1.AutoMlAsyncClient() # Initialize request argument(s) request = automl_v1beta1.ListDatasetsRequest( @@ -490,7 +490,7 @@ def sample_list_datasets(): page_result = client.list_datasets(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -595,9 +595,9 @@ async def update_dataset( from google.cloud import automl_v1beta1 - def sample_update_dataset(): + async def sample_update_dataset(): # Create a client - client = automl_v1beta1.AutoMlClient() + client = automl_v1beta1.AutoMlAsyncClient() # Initialize request argument(s) dataset = automl_v1beta1.Dataset() @@ -609,7 +609,7 @@ def sample_update_dataset(): ) # Make the request - response = client.update_dataset(request=request) + response = await client.update_dataset(request=request) # Handle the response print(response) @@ -702,9 +702,9 @@ async def delete_dataset( from google.cloud import automl_v1beta1 - def sample_delete_dataset(): + async def sample_delete_dataset(): # Create a client - client = automl_v1beta1.AutoMlClient() + client = automl_v1beta1.AutoMlAsyncClient() # Initialize request argument(s) request = automl_v1beta1.DeleteDatasetRequest( @@ -716,7 +716,7 @@ def sample_delete_dataset(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -842,9 +842,9 @@ async def import_data( from google.cloud import automl_v1beta1 - def sample_import_data(): + async def sample_import_data(): # Create a client - client = automl_v1beta1.AutoMlClient() + client = automl_v1beta1.AutoMlAsyncClient() # Initialize request argument(s) request = automl_v1beta1.ImportDataRequest( @@ -856,7 +856,7 @@ def sample_import_data(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -977,9 +977,9 @@ async def export_data( from google.cloud import automl_v1beta1 - def sample_export_data(): + async def sample_export_data(): # Create a client - client = automl_v1beta1.AutoMlClient() + client = automl_v1beta1.AutoMlAsyncClient() # Initialize request argument(s) request = automl_v1beta1.ExportDataRequest( @@ -991,7 +991,7 @@ def sample_export_data(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -1106,9 +1106,9 @@ async def get_annotation_spec( from google.cloud import automl_v1beta1 - def sample_get_annotation_spec(): + async def sample_get_annotation_spec(): # Create a client - client = automl_v1beta1.AutoMlClient() + client = automl_v1beta1.AutoMlAsyncClient() # Initialize request argument(s) request = automl_v1beta1.GetAnnotationSpecRequest( @@ -1116,7 +1116,7 @@ def sample_get_annotation_spec(): ) # Make the request - response = client.get_annotation_spec(request=request) + response = await client.get_annotation_spec(request=request) # Handle the response print(response) @@ -1209,9 +1209,9 @@ async def get_table_spec( from google.cloud import automl_v1beta1 - def sample_get_table_spec(): + async def sample_get_table_spec(): # Create a client - client = automl_v1beta1.AutoMlClient() + client = automl_v1beta1.AutoMlAsyncClient() # Initialize request argument(s) request = automl_v1beta1.GetTableSpecRequest( @@ -1219,7 +1219,7 @@ def sample_get_table_spec(): ) # Make the request - response = client.get_table_spec(request=request) + response = await client.get_table_spec(request=request) # Handle the response print(response) @@ -1322,9 +1322,9 @@ async def list_table_specs( from google.cloud import automl_v1beta1 - def sample_list_table_specs(): + async def sample_list_table_specs(): # Create a client - client = automl_v1beta1.AutoMlClient() + client = automl_v1beta1.AutoMlAsyncClient() # Initialize request argument(s) request = automl_v1beta1.ListTableSpecsRequest( @@ -1335,7 +1335,7 @@ def sample_list_table_specs(): page_result = client.list_table_specs(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -1440,16 +1440,16 @@ async def update_table_spec( from google.cloud import automl_v1beta1 - def sample_update_table_spec(): + async def sample_update_table_spec(): # Create a client - client = automl_v1beta1.AutoMlClient() + client = automl_v1beta1.AutoMlAsyncClient() # Initialize request argument(s) request = automl_v1beta1.UpdateTableSpecRequest( ) # Make the request - response = client.update_table_spec(request=request) + response = await client.update_table_spec(request=request) # Handle the response print(response) @@ -1544,9 +1544,9 @@ async def get_column_spec( from google.cloud import automl_v1beta1 - def sample_get_column_spec(): + async def sample_get_column_spec(): # Create a client - client = automl_v1beta1.AutoMlClient() + client = automl_v1beta1.AutoMlAsyncClient() # Initialize request argument(s) request = automl_v1beta1.GetColumnSpecRequest( @@ -1554,7 +1554,7 @@ def sample_get_column_spec(): ) # Make the request - response = client.get_column_spec(request=request) + response = await client.get_column_spec(request=request) # Handle the response print(response) @@ -1649,9 +1649,9 @@ async def list_column_specs( from google.cloud import automl_v1beta1 - def sample_list_column_specs(): + async def sample_list_column_specs(): # Create a client - client = automl_v1beta1.AutoMlClient() + client = automl_v1beta1.AutoMlAsyncClient() # Initialize request argument(s) request = automl_v1beta1.ListColumnSpecsRequest( @@ -1662,7 +1662,7 @@ def sample_list_column_specs(): page_result = client.list_column_specs(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -1767,16 +1767,16 @@ async def update_column_spec( from google.cloud import automl_v1beta1 - def sample_update_column_spec(): + async def sample_update_column_spec(): # Create a client - client = automl_v1beta1.AutoMlClient() + client = automl_v1beta1.AutoMlAsyncClient() # Initialize request argument(s) request = automl_v1beta1.UpdateColumnSpecRequest( ) # Make the request - response = client.update_column_spec(request=request) + response = await client.update_column_spec(request=request) # Handle the response print(response) @@ -1868,9 +1868,9 @@ async def create_model( from google.cloud import automl_v1beta1 - def sample_create_model(): + async def sample_create_model(): # Create a client - client = automl_v1beta1.AutoMlClient() + client = automl_v1beta1.AutoMlAsyncClient() # Initialize request argument(s) request = automl_v1beta1.CreateModelRequest( @@ -1882,7 +1882,7 @@ def sample_create_model(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -1986,9 +1986,9 @@ async def get_model( from google.cloud import automl_v1beta1 - def sample_get_model(): + async def sample_get_model(): # Create a client - client = automl_v1beta1.AutoMlClient() + client = automl_v1beta1.AutoMlAsyncClient() # Initialize request argument(s) request = automl_v1beta1.GetModelRequest( @@ -1996,7 +1996,7 @@ def sample_get_model(): ) # Make the request - response = client.get_model(request=request) + response = await client.get_model(request=request) # Handle the response print(response) @@ -2089,9 +2089,9 @@ async def list_models( from google.cloud import automl_v1beta1 - def sample_list_models(): + async def sample_list_models(): # Create a client - client = automl_v1beta1.AutoMlClient() + client = automl_v1beta1.AutoMlAsyncClient() # Initialize request argument(s) request = automl_v1beta1.ListModelsRequest( @@ -2102,7 +2102,7 @@ def sample_list_models(): page_result = client.list_models(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -2210,9 +2210,9 @@ async def delete_model( from google.cloud import automl_v1beta1 - def sample_delete_model(): + async def sample_delete_model(): # Create a client - client = automl_v1beta1.AutoMlClient() + client = automl_v1beta1.AutoMlAsyncClient() # Initialize request argument(s) request = automl_v1beta1.DeleteModelRequest( @@ -2224,7 +2224,7 @@ def sample_delete_model(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -2354,9 +2354,9 @@ async def deploy_model( from google.cloud import automl_v1beta1 - def sample_deploy_model(): + async def sample_deploy_model(): # Create a client - client = automl_v1beta1.AutoMlClient() + client = automl_v1beta1.AutoMlAsyncClient() # Initialize request argument(s) request = automl_v1beta1.DeployModelRequest( @@ -2368,7 +2368,7 @@ def sample_deploy_model(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -2482,9 +2482,9 @@ async def undeploy_model( from google.cloud import automl_v1beta1 - def sample_undeploy_model(): + async def sample_undeploy_model(): # Create a client - client = automl_v1beta1.AutoMlClient() + client = automl_v1beta1.AutoMlAsyncClient() # Initialize request argument(s) request = automl_v1beta1.UndeployModelRequest( @@ -2496,7 +2496,7 @@ def sample_undeploy_model(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -2611,9 +2611,9 @@ async def export_model( from google.cloud import automl_v1beta1 - def sample_export_model(): + async def sample_export_model(): # Create a client - client = automl_v1beta1.AutoMlClient() + client = automl_v1beta1.AutoMlAsyncClient() # Initialize request argument(s) request = automl_v1beta1.ExportModelRequest( @@ -2625,7 +2625,7 @@ def sample_export_model(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -2757,9 +2757,9 @@ async def export_evaluated_examples( from google.cloud import automl_v1beta1 - def sample_export_evaluated_examples(): + async def sample_export_evaluated_examples(): # Create a client - client = automl_v1beta1.AutoMlClient() + client = automl_v1beta1.AutoMlAsyncClient() # Initialize request argument(s) request = automl_v1beta1.ExportEvaluatedExamplesRequest( @@ -2771,7 +2771,7 @@ def sample_export_evaluated_examples(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -2887,9 +2887,9 @@ async def get_model_evaluation( from google.cloud import automl_v1beta1 - def sample_get_model_evaluation(): + async def sample_get_model_evaluation(): # Create a client - client = automl_v1beta1.AutoMlClient() + client = automl_v1beta1.AutoMlAsyncClient() # Initialize request argument(s) request = automl_v1beta1.GetModelEvaluationRequest( @@ -2897,7 +2897,7 @@ def sample_get_model_evaluation(): ) # Make the request - response = client.get_model_evaluation(request=request) + response = await client.get_model_evaluation(request=request) # Handle the response print(response) @@ -2990,9 +2990,9 @@ async def list_model_evaluations( from google.cloud import automl_v1beta1 - def sample_list_model_evaluations(): + async def sample_list_model_evaluations(): # Create a client - client = automl_v1beta1.AutoMlClient() + client = automl_v1beta1.AutoMlAsyncClient() # Initialize request argument(s) request = automl_v1beta1.ListModelEvaluationsRequest( @@ -3003,7 +3003,7 @@ def sample_list_model_evaluations(): page_result = client.list_model_evaluations(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: diff --git a/packages/google-cloud-automl/google/cloud/automl_v1beta1/services/prediction_service/async_client.py b/packages/google-cloud-automl/google/cloud/automl_v1beta1/services/prediction_service/async_client.py index a1e9864060b3..30ecb60099b6 100644 --- a/packages/google-cloud-automl/google/cloud/automl_v1beta1/services/prediction_service/async_client.py +++ b/packages/google-cloud-automl/google/cloud/automl_v1beta1/services/prediction_service/async_client.py @@ -248,9 +248,9 @@ async def predict( from google.cloud import automl_v1beta1 - def sample_predict(): + async def sample_predict(): # Create a client - client = automl_v1beta1.PredictionServiceClient() + client = automl_v1beta1.PredictionServiceAsyncClient() # Initialize request argument(s) payload = automl_v1beta1.ExamplePayload() @@ -262,7 +262,7 @@ def sample_predict(): ) # Make the request - response = client.predict(request=request) + response = await client.predict(request=request) # Handle the response print(response) @@ -407,9 +407,9 @@ async def batch_predict( from google.cloud import automl_v1beta1 - def sample_batch_predict(): + async def sample_batch_predict(): # Create a client - client = automl_v1beta1.PredictionServiceClient() + client = automl_v1beta1.PredictionServiceAsyncClient() # Initialize request argument(s) request = automl_v1beta1.BatchPredictRequest( @@ -421,7 +421,7 @@ def sample_batch_predict(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) diff --git a/packages/google-cloud-automl/tests/unit/gapic/automl_v1/test_auto_ml.py b/packages/google-cloud-automl/tests/unit/gapic/automl_v1/test_auto_ml.py index 47a4f2836b83..2fcf834a813a 100644 --- a/packages/google-cloud-automl/tests/unit/gapic/automl_v1/test_auto_ml.py +++ b/packages/google-cloud-automl/tests/unit/gapic/automl_v1/test_auto_ml.py @@ -715,7 +715,7 @@ def test_create_dataset_field_headers(): # a field header. Set these to a non-empty value. request = service.CreateDatasetRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_dataset), "__call__") as call: @@ -731,7 +731,7 @@ def test_create_dataset_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -745,7 +745,7 @@ async def test_create_dataset_field_headers_async(): # a field header. Set these to a non-empty value. request = service.CreateDatasetRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_dataset), "__call__") as call: @@ -763,7 +763,7 @@ async def test_create_dataset_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -1000,7 +1000,7 @@ def test_get_dataset_field_headers(): # a field header. Set these to a non-empty value. request = service.GetDatasetRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_dataset), "__call__") as call: @@ -1016,7 +1016,7 @@ def test_get_dataset_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1030,7 +1030,7 @@ async def test_get_dataset_field_headers_async(): # a field header. Set these to a non-empty value. request = service.GetDatasetRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_dataset), "__call__") as call: @@ -1046,7 +1046,7 @@ async def test_get_dataset_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1228,7 +1228,7 @@ def test_list_datasets_field_headers(): # a field header. Set these to a non-empty value. request = service.ListDatasetsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_datasets), "__call__") as call: @@ -1244,7 +1244,7 @@ def test_list_datasets_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -1258,7 +1258,7 @@ async def test_list_datasets_field_headers_async(): # a field header. Set these to a non-empty value. request = service.ListDatasetsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_datasets), "__call__") as call: @@ -1276,7 +1276,7 @@ async def test_list_datasets_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -1407,7 +1407,7 @@ def test_list_datasets_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, dataset.Dataset) for i in results) @@ -1667,7 +1667,7 @@ def test_update_dataset_field_headers(): # a field header. Set these to a non-empty value. request = service.UpdateDatasetRequest() - request.dataset.name = "dataset.name/value" + request.dataset.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_dataset), "__call__") as call: @@ -1683,7 +1683,7 @@ def test_update_dataset_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "dataset.name=dataset.name/value", + "dataset.name=name_value", ) in kw["metadata"] @@ -1697,7 +1697,7 @@ async def test_update_dataset_field_headers_async(): # a field header. Set these to a non-empty value. request = service.UpdateDatasetRequest() - request.dataset.name = "dataset.name/value" + request.dataset.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_dataset), "__call__") as call: @@ -1713,7 +1713,7 @@ async def test_update_dataset_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "dataset.name=dataset.name/value", + "dataset.name=name_value", ) in kw["metadata"] @@ -1923,7 +1923,7 @@ def test_delete_dataset_field_headers(): # a field header. Set these to a non-empty value. request = service.DeleteDatasetRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_dataset), "__call__") as call: @@ -1939,7 +1939,7 @@ def test_delete_dataset_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1953,7 +1953,7 @@ async def test_delete_dataset_field_headers_async(): # a field header. Set these to a non-empty value. request = service.DeleteDatasetRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_dataset), "__call__") as call: @@ -1971,7 +1971,7 @@ async def test_delete_dataset_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -2149,7 +2149,7 @@ def test_import_data_field_headers(): # a field header. Set these to a non-empty value. request = service.ImportDataRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.import_data), "__call__") as call: @@ -2165,7 +2165,7 @@ def test_import_data_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -2179,7 +2179,7 @@ async def test_import_data_field_headers_async(): # a field header. Set these to a non-empty value. request = service.ImportDataRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.import_data), "__call__") as call: @@ -2197,7 +2197,7 @@ async def test_import_data_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -2397,7 +2397,7 @@ def test_export_data_field_headers(): # a field header. Set these to a non-empty value. request = service.ExportDataRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.export_data), "__call__") as call: @@ -2413,7 +2413,7 @@ def test_export_data_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -2427,7 +2427,7 @@ async def test_export_data_field_headers_async(): # a field header. Set these to a non-empty value. request = service.ExportDataRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.export_data), "__call__") as call: @@ -2445,7 +2445,7 @@ async def test_export_data_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -2677,7 +2677,7 @@ def test_get_annotation_spec_field_headers(): # a field header. Set these to a non-empty value. request = service.GetAnnotationSpecRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2695,7 +2695,7 @@ def test_get_annotation_spec_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -2709,7 +2709,7 @@ async def test_get_annotation_spec_field_headers_async(): # a field header. Set these to a non-empty value. request = service.GetAnnotationSpecRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2729,7 +2729,7 @@ async def test_get_annotation_spec_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -2911,7 +2911,7 @@ def test_create_model_field_headers(): # a field header. Set these to a non-empty value. request = service.CreateModelRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_model), "__call__") as call: @@ -2927,7 +2927,7 @@ def test_create_model_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -2941,7 +2941,7 @@ async def test_create_model_field_headers_async(): # a field header. Set these to a non-empty value. request = service.CreateModelRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_model), "__call__") as call: @@ -2959,7 +2959,7 @@ async def test_create_model_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -3196,7 +3196,7 @@ def test_get_model_field_headers(): # a field header. Set these to a non-empty value. request = service.GetModelRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_model), "__call__") as call: @@ -3212,7 +3212,7 @@ def test_get_model_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -3226,7 +3226,7 @@ async def test_get_model_field_headers_async(): # a field header. Set these to a non-empty value. request = service.GetModelRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_model), "__call__") as call: @@ -3242,7 +3242,7 @@ async def test_get_model_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -3424,7 +3424,7 @@ def test_list_models_field_headers(): # a field header. Set these to a non-empty value. request = service.ListModelsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_models), "__call__") as call: @@ -3440,7 +3440,7 @@ def test_list_models_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -3454,7 +3454,7 @@ async def test_list_models_field_headers_async(): # a field header. Set these to a non-empty value. request = service.ListModelsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_models), "__call__") as call: @@ -3472,7 +3472,7 @@ async def test_list_models_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -3603,7 +3603,7 @@ def test_list_models_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, model.Model) for i in results) @@ -3838,7 +3838,7 @@ def test_delete_model_field_headers(): # a field header. Set these to a non-empty value. request = service.DeleteModelRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_model), "__call__") as call: @@ -3854,7 +3854,7 @@ def test_delete_model_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -3868,7 +3868,7 @@ async def test_delete_model_field_headers_async(): # a field header. Set these to a non-empty value. request = service.DeleteModelRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_model), "__call__") as call: @@ -3886,7 +3886,7 @@ async def test_delete_model_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -4089,7 +4089,7 @@ def test_update_model_field_headers(): # a field header. Set these to a non-empty value. request = service.UpdateModelRequest() - request.model.name = "model.name/value" + request.model.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_model), "__call__") as call: @@ -4105,7 +4105,7 @@ def test_update_model_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "model.name=model.name/value", + "model.name=name_value", ) in kw["metadata"] @@ -4119,7 +4119,7 @@ async def test_update_model_field_headers_async(): # a field header. Set these to a non-empty value. request = service.UpdateModelRequest() - request.model.name = "model.name/value" + request.model.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_model), "__call__") as call: @@ -4135,7 +4135,7 @@ async def test_update_model_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "model.name=model.name/value", + "model.name=name_value", ) in kw["metadata"] @@ -4345,7 +4345,7 @@ def test_deploy_model_field_headers(): # a field header. Set these to a non-empty value. request = service.DeployModelRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.deploy_model), "__call__") as call: @@ -4361,7 +4361,7 @@ def test_deploy_model_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -4375,7 +4375,7 @@ async def test_deploy_model_field_headers_async(): # a field header. Set these to a non-empty value. request = service.DeployModelRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.deploy_model), "__call__") as call: @@ -4393,7 +4393,7 @@ async def test_deploy_model_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -4571,7 +4571,7 @@ def test_undeploy_model_field_headers(): # a field header. Set these to a non-empty value. request = service.UndeployModelRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.undeploy_model), "__call__") as call: @@ -4587,7 +4587,7 @@ def test_undeploy_model_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -4601,7 +4601,7 @@ async def test_undeploy_model_field_headers_async(): # a field header. Set these to a non-empty value. request = service.UndeployModelRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.undeploy_model), "__call__") as call: @@ -4619,7 +4619,7 @@ async def test_undeploy_model_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -4797,7 +4797,7 @@ def test_export_model_field_headers(): # a field header. Set these to a non-empty value. request = service.ExportModelRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.export_model), "__call__") as call: @@ -4813,7 +4813,7 @@ def test_export_model_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -4827,7 +4827,7 @@ async def test_export_model_field_headers_async(): # a field header. Set these to a non-empty value. request = service.ExportModelRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.export_model), "__call__") as call: @@ -4845,7 +4845,7 @@ async def test_export_model_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -5084,7 +5084,7 @@ def test_get_model_evaluation_field_headers(): # a field header. Set these to a non-empty value. request = service.GetModelEvaluationRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5102,7 +5102,7 @@ def test_get_model_evaluation_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -5116,7 +5116,7 @@ async def test_get_model_evaluation_field_headers_async(): # a field header. Set these to a non-empty value. request = service.GetModelEvaluationRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5136,7 +5136,7 @@ async def test_get_model_evaluation_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -5330,7 +5330,7 @@ def test_list_model_evaluations_field_headers(): # a field header. Set these to a non-empty value. request = service.ListModelEvaluationsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5348,7 +5348,7 @@ def test_list_model_evaluations_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -5362,7 +5362,7 @@ async def test_list_model_evaluations_field_headers_async(): # a field header. Set these to a non-empty value. request = service.ListModelEvaluationsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5382,7 +5382,7 @@ async def test_list_model_evaluations_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -5529,7 +5529,7 @@ def test_list_model_evaluations_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, model_evaluation.ModelEvaluation) for i in results) diff --git a/packages/google-cloud-automl/tests/unit/gapic/automl_v1/test_prediction_service.py b/packages/google-cloud-automl/tests/unit/gapic/automl_v1/test_prediction_service.py index c20e33f403f9..20fa8bbc4a3b 100644 --- a/packages/google-cloud-automl/tests/unit/gapic/automl_v1/test_prediction_service.py +++ b/packages/google-cloud-automl/tests/unit/gapic/automl_v1/test_prediction_service.py @@ -764,7 +764,7 @@ def test_predict_field_headers(): # a field header. Set these to a non-empty value. request = prediction_service.PredictRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.predict), "__call__") as call: @@ -780,7 +780,7 @@ def test_predict_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -794,7 +794,7 @@ async def test_predict_field_headers_async(): # a field header. Set these to a non-empty value. request = prediction_service.PredictRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.predict), "__call__") as call: @@ -812,7 +812,7 @@ async def test_predict_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1022,7 +1022,7 @@ def test_batch_predict_field_headers(): # a field header. Set these to a non-empty value. request = prediction_service.BatchPredictRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.batch_predict), "__call__") as call: @@ -1038,7 +1038,7 @@ def test_batch_predict_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1052,7 +1052,7 @@ async def test_batch_predict_field_headers_async(): # a field header. Set these to a non-empty value. request = prediction_service.BatchPredictRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.batch_predict), "__call__") as call: @@ -1070,7 +1070,7 @@ async def test_batch_predict_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] diff --git a/packages/google-cloud-automl/tests/unit/gapic/automl_v1beta1/test_auto_ml.py b/packages/google-cloud-automl/tests/unit/gapic/automl_v1beta1/test_auto_ml.py index 94fe5676d798..561f07891e23 100644 --- a/packages/google-cloud-automl/tests/unit/gapic/automl_v1beta1/test_auto_ml.py +++ b/packages/google-cloud-automl/tests/unit/gapic/automl_v1beta1/test_auto_ml.py @@ -749,7 +749,7 @@ def test_create_dataset_field_headers(): # a field header. Set these to a non-empty value. request = service.CreateDatasetRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_dataset), "__call__") as call: @@ -765,7 +765,7 @@ def test_create_dataset_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -779,7 +779,7 @@ async def test_create_dataset_field_headers_async(): # a field header. Set these to a non-empty value. request = service.CreateDatasetRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_dataset), "__call__") as call: @@ -795,7 +795,7 @@ async def test_create_dataset_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -1030,7 +1030,7 @@ def test_get_dataset_field_headers(): # a field header. Set these to a non-empty value. request = service.GetDatasetRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_dataset), "__call__") as call: @@ -1046,7 +1046,7 @@ def test_get_dataset_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1060,7 +1060,7 @@ async def test_get_dataset_field_headers_async(): # a field header. Set these to a non-empty value. request = service.GetDatasetRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_dataset), "__call__") as call: @@ -1076,7 +1076,7 @@ async def test_get_dataset_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1258,7 +1258,7 @@ def test_list_datasets_field_headers(): # a field header. Set these to a non-empty value. request = service.ListDatasetsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_datasets), "__call__") as call: @@ -1274,7 +1274,7 @@ def test_list_datasets_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -1288,7 +1288,7 @@ async def test_list_datasets_field_headers_async(): # a field header. Set these to a non-empty value. request = service.ListDatasetsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_datasets), "__call__") as call: @@ -1306,7 +1306,7 @@ async def test_list_datasets_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -1437,7 +1437,7 @@ def test_list_datasets_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, dataset.Dataset) for i in results) @@ -1697,7 +1697,7 @@ def test_update_dataset_field_headers(): # a field header. Set these to a non-empty value. request = service.UpdateDatasetRequest() - request.dataset.name = "dataset.name/value" + request.dataset.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_dataset), "__call__") as call: @@ -1713,7 +1713,7 @@ def test_update_dataset_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "dataset.name=dataset.name/value", + "dataset.name=name_value", ) in kw["metadata"] @@ -1727,7 +1727,7 @@ async def test_update_dataset_field_headers_async(): # a field header. Set these to a non-empty value. request = service.UpdateDatasetRequest() - request.dataset.name = "dataset.name/value" + request.dataset.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_dataset), "__call__") as call: @@ -1743,7 +1743,7 @@ async def test_update_dataset_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "dataset.name=dataset.name/value", + "dataset.name=name_value", ) in kw["metadata"] @@ -1943,7 +1943,7 @@ def test_delete_dataset_field_headers(): # a field header. Set these to a non-empty value. request = service.DeleteDatasetRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_dataset), "__call__") as call: @@ -1959,7 +1959,7 @@ def test_delete_dataset_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1973,7 +1973,7 @@ async def test_delete_dataset_field_headers_async(): # a field header. Set these to a non-empty value. request = service.DeleteDatasetRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_dataset), "__call__") as call: @@ -1991,7 +1991,7 @@ async def test_delete_dataset_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -2169,7 +2169,7 @@ def test_import_data_field_headers(): # a field header. Set these to a non-empty value. request = service.ImportDataRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.import_data), "__call__") as call: @@ -2185,7 +2185,7 @@ def test_import_data_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -2199,7 +2199,7 @@ async def test_import_data_field_headers_async(): # a field header. Set these to a non-empty value. request = service.ImportDataRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.import_data), "__call__") as call: @@ -2217,7 +2217,7 @@ async def test_import_data_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -2417,7 +2417,7 @@ def test_export_data_field_headers(): # a field header. Set these to a non-empty value. request = service.ExportDataRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.export_data), "__call__") as call: @@ -2433,7 +2433,7 @@ def test_export_data_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -2447,7 +2447,7 @@ async def test_export_data_field_headers_async(): # a field header. Set these to a non-empty value. request = service.ExportDataRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.export_data), "__call__") as call: @@ -2465,7 +2465,7 @@ async def test_export_data_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -2697,7 +2697,7 @@ def test_get_annotation_spec_field_headers(): # a field header. Set these to a non-empty value. request = service.GetAnnotationSpecRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2715,7 +2715,7 @@ def test_get_annotation_spec_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -2729,7 +2729,7 @@ async def test_get_annotation_spec_field_headers_async(): # a field header. Set these to a non-empty value. request = service.GetAnnotationSpecRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2749,7 +2749,7 @@ async def test_get_annotation_spec_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -2957,7 +2957,7 @@ def test_get_table_spec_field_headers(): # a field header. Set these to a non-empty value. request = service.GetTableSpecRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_table_spec), "__call__") as call: @@ -2973,7 +2973,7 @@ def test_get_table_spec_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -2987,7 +2987,7 @@ async def test_get_table_spec_field_headers_async(): # a field header. Set these to a non-empty value. request = service.GetTableSpecRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_table_spec), "__call__") as call: @@ -3005,7 +3005,7 @@ async def test_get_table_spec_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -3189,7 +3189,7 @@ def test_list_table_specs_field_headers(): # a field header. Set these to a non-empty value. request = service.ListTableSpecsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_table_specs), "__call__") as call: @@ -3205,7 +3205,7 @@ def test_list_table_specs_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -3219,7 +3219,7 @@ async def test_list_table_specs_field_headers_async(): # a field header. Set these to a non-empty value. request = service.ListTableSpecsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_table_specs), "__call__") as call: @@ -3237,7 +3237,7 @@ async def test_list_table_specs_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -3368,7 +3368,7 @@ def test_list_table_specs_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, table_spec.TableSpec) for i in results) @@ -3635,7 +3635,7 @@ def test_update_table_spec_field_headers(): # a field header. Set these to a non-empty value. request = service.UpdateTableSpecRequest() - request.table_spec.name = "table_spec.name/value" + request.table_spec.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3653,7 +3653,7 @@ def test_update_table_spec_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "table_spec.name=table_spec.name/value", + "table_spec.name=name_value", ) in kw["metadata"] @@ -3667,7 +3667,7 @@ async def test_update_table_spec_field_headers_async(): # a field header. Set these to a non-empty value. request = service.UpdateTableSpecRequest() - request.table_spec.name = "table_spec.name/value" + request.table_spec.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3687,7 +3687,7 @@ async def test_update_table_spec_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "table_spec.name=table_spec.name/value", + "table_spec.name=name_value", ) in kw["metadata"] @@ -3883,7 +3883,7 @@ def test_get_column_spec_field_headers(): # a field header. Set these to a non-empty value. request = service.GetColumnSpecRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_column_spec), "__call__") as call: @@ -3899,7 +3899,7 @@ def test_get_column_spec_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -3913,7 +3913,7 @@ async def test_get_column_spec_field_headers_async(): # a field header. Set these to a non-empty value. request = service.GetColumnSpecRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_column_spec), "__call__") as call: @@ -3931,7 +3931,7 @@ async def test_get_column_spec_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -4121,7 +4121,7 @@ def test_list_column_specs_field_headers(): # a field header. Set these to a non-empty value. request = service.ListColumnSpecsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4139,7 +4139,7 @@ def test_list_column_specs_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -4153,7 +4153,7 @@ async def test_list_column_specs_field_headers_async(): # a field header. Set these to a non-empty value. request = service.ListColumnSpecsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4173,7 +4173,7 @@ async def test_list_column_specs_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -4310,7 +4310,7 @@ def test_list_column_specs_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, column_spec.ColumnSpec) for i in results) @@ -4571,7 +4571,7 @@ def test_update_column_spec_field_headers(): # a field header. Set these to a non-empty value. request = service.UpdateColumnSpecRequest() - request.column_spec.name = "column_spec.name/value" + request.column_spec.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4589,7 +4589,7 @@ def test_update_column_spec_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "column_spec.name=column_spec.name/value", + "column_spec.name=name_value", ) in kw["metadata"] @@ -4603,7 +4603,7 @@ async def test_update_column_spec_field_headers_async(): # a field header. Set these to a non-empty value. request = service.UpdateColumnSpecRequest() - request.column_spec.name = "column_spec.name/value" + request.column_spec.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4623,7 +4623,7 @@ async def test_update_column_spec_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "column_spec.name=column_spec.name/value", + "column_spec.name=name_value", ) in kw["metadata"] @@ -4805,7 +4805,7 @@ def test_create_model_field_headers(): # a field header. Set these to a non-empty value. request = service.CreateModelRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_model), "__call__") as call: @@ -4821,7 +4821,7 @@ def test_create_model_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -4835,7 +4835,7 @@ async def test_create_model_field_headers_async(): # a field header. Set these to a non-empty value. request = service.CreateModelRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_model), "__call__") as call: @@ -4853,7 +4853,7 @@ async def test_create_model_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -5086,7 +5086,7 @@ def test_get_model_field_headers(): # a field header. Set these to a non-empty value. request = service.GetModelRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_model), "__call__") as call: @@ -5102,7 +5102,7 @@ def test_get_model_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -5116,7 +5116,7 @@ async def test_get_model_field_headers_async(): # a field header. Set these to a non-empty value. request = service.GetModelRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_model), "__call__") as call: @@ -5132,7 +5132,7 @@ async def test_get_model_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -5314,7 +5314,7 @@ def test_list_models_field_headers(): # a field header. Set these to a non-empty value. request = service.ListModelsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_models), "__call__") as call: @@ -5330,7 +5330,7 @@ def test_list_models_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -5344,7 +5344,7 @@ async def test_list_models_field_headers_async(): # a field header. Set these to a non-empty value. request = service.ListModelsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_models), "__call__") as call: @@ -5362,7 +5362,7 @@ async def test_list_models_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -5493,7 +5493,7 @@ def test_list_models_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, model.Model) for i in results) @@ -5728,7 +5728,7 @@ def test_delete_model_field_headers(): # a field header. Set these to a non-empty value. request = service.DeleteModelRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_model), "__call__") as call: @@ -5744,7 +5744,7 @@ def test_delete_model_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -5758,7 +5758,7 @@ async def test_delete_model_field_headers_async(): # a field header. Set these to a non-empty value. request = service.DeleteModelRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_model), "__call__") as call: @@ -5776,7 +5776,7 @@ async def test_delete_model_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -5954,7 +5954,7 @@ def test_deploy_model_field_headers(): # a field header. Set these to a non-empty value. request = service.DeployModelRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.deploy_model), "__call__") as call: @@ -5970,7 +5970,7 @@ def test_deploy_model_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -5984,7 +5984,7 @@ async def test_deploy_model_field_headers_async(): # a field header. Set these to a non-empty value. request = service.DeployModelRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.deploy_model), "__call__") as call: @@ -6002,7 +6002,7 @@ async def test_deploy_model_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -6180,7 +6180,7 @@ def test_undeploy_model_field_headers(): # a field header. Set these to a non-empty value. request = service.UndeployModelRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.undeploy_model), "__call__") as call: @@ -6196,7 +6196,7 @@ def test_undeploy_model_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -6210,7 +6210,7 @@ async def test_undeploy_model_field_headers_async(): # a field header. Set these to a non-empty value. request = service.UndeployModelRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.undeploy_model), "__call__") as call: @@ -6228,7 +6228,7 @@ async def test_undeploy_model_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -6406,7 +6406,7 @@ def test_export_model_field_headers(): # a field header. Set these to a non-empty value. request = service.ExportModelRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.export_model), "__call__") as call: @@ -6422,7 +6422,7 @@ def test_export_model_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -6436,7 +6436,7 @@ async def test_export_model_field_headers_async(): # a field header. Set these to a non-empty value. request = service.ExportModelRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.export_model), "__call__") as call: @@ -6454,7 +6454,7 @@ async def test_export_model_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -6672,7 +6672,7 @@ def test_export_evaluated_examples_field_headers(): # a field header. Set these to a non-empty value. request = service.ExportEvaluatedExamplesRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6690,7 +6690,7 @@ def test_export_evaluated_examples_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -6704,7 +6704,7 @@ async def test_export_evaluated_examples_field_headers_async(): # a field header. Set these to a non-empty value. request = service.ExportEvaluatedExamplesRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6724,7 +6724,7 @@ async def test_export_evaluated_examples_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -6963,7 +6963,7 @@ def test_get_model_evaluation_field_headers(): # a field header. Set these to a non-empty value. request = service.GetModelEvaluationRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6981,7 +6981,7 @@ def test_get_model_evaluation_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -6995,7 +6995,7 @@ async def test_get_model_evaluation_field_headers_async(): # a field header. Set these to a non-empty value. request = service.GetModelEvaluationRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7015,7 +7015,7 @@ async def test_get_model_evaluation_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -7209,7 +7209,7 @@ def test_list_model_evaluations_field_headers(): # a field header. Set these to a non-empty value. request = service.ListModelEvaluationsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7227,7 +7227,7 @@ def test_list_model_evaluations_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -7241,7 +7241,7 @@ async def test_list_model_evaluations_field_headers_async(): # a field header. Set these to a non-empty value. request = service.ListModelEvaluationsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7261,7 +7261,7 @@ async def test_list_model_evaluations_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent/value", + "parent=parent_value", ) in kw["metadata"] @@ -7398,7 +7398,7 @@ def test_list_model_evaluations_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, model_evaluation.ModelEvaluation) for i in results) diff --git a/packages/google-cloud-automl/tests/unit/gapic/automl_v1beta1/test_prediction_service.py b/packages/google-cloud-automl/tests/unit/gapic/automl_v1beta1/test_prediction_service.py index 530887f04adc..1dd1c143fa57 100644 --- a/packages/google-cloud-automl/tests/unit/gapic/automl_v1beta1/test_prediction_service.py +++ b/packages/google-cloud-automl/tests/unit/gapic/automl_v1beta1/test_prediction_service.py @@ -767,7 +767,7 @@ def test_predict_field_headers(): # a field header. Set these to a non-empty value. request = prediction_service.PredictRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.predict), "__call__") as call: @@ -783,7 +783,7 @@ def test_predict_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -797,7 +797,7 @@ async def test_predict_field_headers_async(): # a field header. Set these to a non-empty value. request = prediction_service.PredictRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.predict), "__call__") as call: @@ -815,7 +815,7 @@ async def test_predict_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1025,7 +1025,7 @@ def test_batch_predict_field_headers(): # a field header. Set these to a non-empty value. request = prediction_service.BatchPredictRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.batch_predict), "__call__") as call: @@ -1041,7 +1041,7 @@ def test_batch_predict_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"] @@ -1055,7 +1055,7 @@ async def test_batch_predict_field_headers_async(): # a field header. Set these to a non-empty value. request = prediction_service.BatchPredictRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.batch_predict), "__call__") as call: @@ -1073,7 +1073,7 @@ async def test_batch_predict_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name/value", + "name=name_value", ) in kw["metadata"]