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

Commit

Permalink
chore: drop six (#255)
Browse files Browse the repository at this point in the history
Also, avoid using default environment credentials in unit tests
  • Loading branch information
tseaver committed Sep 21, 2021
1 parent f689919 commit d673fbd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 2 additions & 3 deletions google/cloud/automl_v1beta1/services/tables/tables_client.py
Expand Up @@ -19,7 +19,6 @@
import copy
import logging
import pkg_resources
import six

from google.api_core.gapic_v1 import client_info

Expand Down Expand Up @@ -63,9 +62,9 @@ def to_proto_value(value):
# This check needs to happen before isinstance(value, int),
# isinstance(value, int) returns True when value is bool.
return struct_pb2.Value(bool_value=value), None
elif isinstance(value, six.integer_types) or isinstance(value, float):
elif isinstance(value, int) or isinstance(value, float):
return struct_pb2.Value(number_value=value), None
elif isinstance(value, six.string_types) or isinstance(value, six.text_type):
elif isinstance(value, str):
return struct_pb2.Value(string_value=value), None
elif isinstance(value, dict):
struct_value = struct_pb2.Struct()
Expand Down
5 changes: 4 additions & 1 deletion tests/unit/test_tables_client_v1beta1.py
Expand Up @@ -1714,12 +1714,15 @@ def test_prediction_client_credentials(self):
assert prediction_client_kwargs["credentials"] == credentials_mock

def test_prediction_client_client_info(self):
credentials_mock = mock.Mock()
client_info_mock = mock.Mock()
patch_prediction_client = mock.patch(
"google.cloud.automl_v1beta1.services.tables.tables_client.PredictionServiceClient"
)
with patch_prediction_client as MockPredictionClient:
automl_v1beta1.TablesClient(client_info=client_info_mock)
automl_v1beta1.TablesClient(
credentials=credentials_mock, client_info=client_info_mock,
)
_, prediction_client_kwargs = MockPredictionClient.call_args
assert "client_info" in prediction_client_kwargs
assert prediction_client_kwargs["client_info"] == client_info_mock

0 comments on commit d673fbd

Please sign in to comment.