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

Commit 75783ec

Browse files
vimotahelinwang
authored andcommitted
fix(automl): fix TypeError when passing a client_info to automl TablesClient (#9949)
* fix(automl): fix TypeError when passing a client_info to automl TablesClient The solution is to delete client_info from kwargs instead and pass named parameter.
1 parent f080ad9 commit 75783ec

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

google/cloud/automl_v1beta1/tables/tables_client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ def __init__(
104104
else:
105105
client_info_.user_agent = user_agent
106106
client_info_.gapic_version = version
107+
kwargs.pop("client_info", None)
107108

108109
if client is None:
109110
self.auto_ml_client = gapic.auto_ml_client.AutoMlClient(

tests/unit/gapic/v1beta1/test_tables_client_v1beta1.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1424,3 +1424,14 @@ def test_prediction_client_credentials(self):
14241424
_, prediction_client_kwargs = MockPredictionClient.call_args
14251425
assert "credentials" in prediction_client_kwargs
14261426
assert prediction_client_kwargs["credentials"] == credentials_mock
1427+
1428+
def test_prediction_client_client_info(self):
1429+
client_info_mock = mock.Mock()
1430+
patch_prediction_client = mock.patch(
1431+
"google.cloud.automl_v1beta1.gapic.prediction_service_client.PredictionServiceClient"
1432+
)
1433+
with patch_prediction_client as MockPredictionClient:
1434+
client = automl_v1beta1.TablesClient(client_info=client_info_mock)
1435+
_, prediction_client_kwargs = MockPredictionClient.call_args
1436+
assert "client_info" in prediction_client_kwargs
1437+
assert prediction_client_kwargs["client_info"] == client_info_mock

0 commit comments

Comments
 (0)