Skip to content

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 authored Sep 21, 2021
1 parent 67c53ae commit 339af1d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 339af1d

Please sign in to comment.