Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content
This repository was archived by the owner on Apr 20, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions google/cloud/speech_v1p1beta1/services/adaptation/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,8 @@ def sample_create_phrase_set():
``us`` (US North America), and ``eu`` (Europe). If you
are calling the ``speech.googleapis.com`` endpoint, use
the ``global`` location. To specify a region, use a
`regional endpoint </speech-to-text/docs/endpoints>`__
`regional
endpoint <https://cloud.google.com/speech-to-text/docs/endpoints>`__
with matching ``us`` or ``eu`` location value.

This corresponds to the ``parent`` field
Expand Down Expand Up @@ -376,7 +377,8 @@ def sample_get_phrase_set():
``us`` (US North America), and ``eu`` (Europe). If you
are calling the ``speech.googleapis.com`` endpoint, use
the ``global`` location. To specify a region, use a
`regional endpoint </speech-to-text/docs/endpoints>`__
`regional
endpoint <https://cloud.google.com/speech-to-text/docs/endpoints>`__
with matching ``us`` or ``eu`` location value.

This corresponds to the ``name`` field
Expand Down Expand Up @@ -482,7 +484,8 @@ def sample_list_phrase_set():
``us`` (US North America), and ``eu`` (Europe). If you
are calling the ``speech.googleapis.com`` endpoint, use
the ``global`` location. To specify a region, use a
`regional endpoint </speech-to-text/docs/endpoints>`__
`regional
endpoint <https://cloud.google.com/speech-to-text/docs/endpoints>`__
with matching ``us`` or ``eu`` location value.

This corresponds to the ``parent`` field
Expand Down Expand Up @@ -600,7 +603,8 @@ def sample_update_phrase_set():
``us`` (US North America), and ``eu`` (Europe). If you
are calling the ``speech.googleapis.com`` endpoint, use
the ``global`` location. To specify a region, use a
`regional endpoint </speech-to-text/docs/endpoints>`__
`regional
endpoint <https://cloud.google.com/speech-to-text/docs/endpoints>`__
with matching ``us`` or ``eu`` location value.

This corresponds to the ``phrase_set`` field
Expand Down Expand Up @@ -801,7 +805,8 @@ def sample_create_custom_class():
``us`` (US North America), and ``eu`` (Europe). If you
are calling the ``speech.googleapis.com`` endpoint, use
the ``global`` location. To specify a region, use a
`regional endpoint </speech-to-text/docs/endpoints>`__
`regional
endpoint <https://cloud.google.com/speech-to-text/docs/endpoints>`__
with matching ``us`` or ``eu`` location value.

This corresponds to the ``parent`` field
Expand Down Expand Up @@ -1033,7 +1038,8 @@ def sample_list_custom_classes():
``us`` (US North America), and ``eu`` (Europe). If you
are calling the ``speech.googleapis.com`` endpoint, use
the ``global`` location. To specify a region, use a
`regional endpoint </speech-to-text/docs/endpoints>`__
`regional
endpoint <https://cloud.google.com/speech-to-text/docs/endpoints>`__
with matching ``us`` or ``eu`` location value.

This corresponds to the ``parent`` field
Expand Down Expand Up @@ -1151,7 +1157,8 @@ def sample_update_custom_class():
``us`` (US North America), and ``eu`` (Europe). If you
are calling the ``speech.googleapis.com`` endpoint, use
the ``global`` location. To specify a region, use a
`regional endpoint </speech-to-text/docs/endpoints>`__
`regional
endpoint <https://cloud.google.com/speech-to-text/docs/endpoints>`__
with matching ``us`` or ``eu`` location value.

This corresponds to the ``custom_class`` field
Expand Down Expand Up @@ -1266,7 +1273,8 @@ def sample_delete_custom_class():
``us`` (US North America), and ``eu`` (Europe). If you
are calling the ``speech.googleapis.com`` endpoint, use
the ``global`` location. To specify a region, use a
`regional endpoint </speech-to-text/docs/endpoints>`__
`regional
endpoint <https://cloud.google.com/speech-to-text/docs/endpoints>`__
with matching ``us`` or ``eu`` location value.

This corresponds to the ``name`` field
Expand Down
24 changes: 16 additions & 8 deletions google/cloud/speech_v1p1beta1/services/adaptation/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,8 @@ def sample_create_phrase_set():
``us`` (US North America), and ``eu`` (Europe). If you
are calling the ``speech.googleapis.com`` endpoint, use
the ``global`` location. To specify a region, use a
`regional endpoint </speech-to-text/docs/endpoints>`__
`regional
endpoint <https://cloud.google.com/speech-to-text/docs/endpoints>`__
with matching ``us`` or ``eu`` location value.

This corresponds to the ``parent`` field
Expand Down Expand Up @@ -624,7 +625,8 @@ def sample_get_phrase_set():
``us`` (US North America), and ``eu`` (Europe). If you
are calling the ``speech.googleapis.com`` endpoint, use
the ``global`` location. To specify a region, use a
`regional endpoint </speech-to-text/docs/endpoints>`__
`regional
endpoint <https://cloud.google.com/speech-to-text/docs/endpoints>`__
with matching ``us`` or ``eu`` location value.

This corresponds to the ``name`` field
Expand Down Expand Up @@ -730,7 +732,8 @@ def sample_list_phrase_set():
``us`` (US North America), and ``eu`` (Europe). If you
are calling the ``speech.googleapis.com`` endpoint, use
the ``global`` location. To specify a region, use a
`regional endpoint </speech-to-text/docs/endpoints>`__
`regional
endpoint <https://cloud.google.com/speech-to-text/docs/endpoints>`__
with matching ``us`` or ``eu`` location value.

This corresponds to the ``parent`` field
Expand Down Expand Up @@ -848,7 +851,8 @@ def sample_update_phrase_set():
``us`` (US North America), and ``eu`` (Europe). If you
are calling the ``speech.googleapis.com`` endpoint, use
the ``global`` location. To specify a region, use a
`regional endpoint </speech-to-text/docs/endpoints>`__
`regional
endpoint <https://cloud.google.com/speech-to-text/docs/endpoints>`__
with matching ``us`` or ``eu`` location value.

This corresponds to the ``phrase_set`` field
Expand Down Expand Up @@ -1049,7 +1053,8 @@ def sample_create_custom_class():
``us`` (US North America), and ``eu`` (Europe). If you
are calling the ``speech.googleapis.com`` endpoint, use
the ``global`` location. To specify a region, use a
`regional endpoint </speech-to-text/docs/endpoints>`__
`regional
endpoint <https://cloud.google.com/speech-to-text/docs/endpoints>`__
with matching ``us`` or ``eu`` location value.

This corresponds to the ``parent`` field
Expand Down Expand Up @@ -1281,7 +1286,8 @@ def sample_list_custom_classes():
``us`` (US North America), and ``eu`` (Europe). If you
are calling the ``speech.googleapis.com`` endpoint, use
the ``global`` location. To specify a region, use a
`regional endpoint </speech-to-text/docs/endpoints>`__
`regional
endpoint <https://cloud.google.com/speech-to-text/docs/endpoints>`__
with matching ``us`` or ``eu`` location value.

This corresponds to the ``parent`` field
Expand Down Expand Up @@ -1399,7 +1405,8 @@ def sample_update_custom_class():
``us`` (US North America), and ``eu`` (Europe). If you
are calling the ``speech.googleapis.com`` endpoint, use
the ``global`` location. To specify a region, use a
`regional endpoint </speech-to-text/docs/endpoints>`__
`regional
endpoint <https://cloud.google.com/speech-to-text/docs/endpoints>`__
with matching ``us`` or ``eu`` location value.

This corresponds to the ``custom_class`` field
Expand Down Expand Up @@ -1514,7 +1521,8 @@ def sample_delete_custom_class():
``us`` (US North America), and ``eu`` (Europe). If you
are calling the ``speech.googleapis.com`` endpoint, use
the ``global`` location. To specify a region, use a
`regional endpoint </speech-to-text/docs/endpoints>`__
`regional
endpoint <https://cloud.google.com/speech-to-text/docs/endpoints>`__
with matching ``us`` or ``eu`` location value.

This corresponds to the ``name`` field
Expand Down
32 changes: 16 additions & 16 deletions google/cloud/speech_v1p1beta1/types/cloud_speech_adaptation.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ class CreatePhraseSetRequest(proto.Message):
(US North America), and ``eu`` (Europe). If you are calling
the ``speech.googleapis.com`` endpoint, use the ``global``
location. To specify a region, use a `regional
endpoint </speech-to-text/docs/endpoints>`__ with matching
``us`` or ``eu`` location value.
endpoint <https://cloud.google.com/speech-to-text/docs/endpoints>`__
with matching ``us`` or ``eu`` location value.
phrase_set_id (str):
Required. The ID to use for the phrase set, which will
become the final component of the phrase set's resource
Expand Down Expand Up @@ -96,8 +96,8 @@ class UpdatePhraseSetRequest(proto.Message):
(US North America), and ``eu`` (Europe). If you are calling
the ``speech.googleapis.com`` endpoint, use the ``global``
location. To specify a region, use a `regional
endpoint </speech-to-text/docs/endpoints>`__ with matching
``us`` or ``eu`` location value.
endpoint <https://cloud.google.com/speech-to-text/docs/endpoints>`__
with matching ``us`` or ``eu`` location value.
update_mask (google.protobuf.field_mask_pb2.FieldMask):
The list of fields to be updated.
"""
Expand Down Expand Up @@ -127,8 +127,8 @@ class GetPhraseSetRequest(proto.Message):
(US North America), and ``eu`` (Europe). If you are calling
the ``speech.googleapis.com`` endpoint, use the ``global``
location. To specify a region, use a `regional
endpoint </speech-to-text/docs/endpoints>`__ with matching
``us`` or ``eu`` location value.
endpoint <https://cloud.google.com/speech-to-text/docs/endpoints>`__
with matching ``us`` or ``eu`` location value.
"""

name = proto.Field(
Expand All @@ -151,8 +151,8 @@ class ListPhraseSetRequest(proto.Message):
(US North America), and ``eu`` (Europe). If you are calling
the ``speech.googleapis.com`` endpoint, use the ``global``
location. To specify a region, use a `regional
endpoint </speech-to-text/docs/endpoints>`__ with matching
``us`` or ``eu`` location value.
endpoint <https://cloud.google.com/speech-to-text/docs/endpoints>`__
with matching ``us`` or ``eu`` location value.
page_size (int):
The maximum number of phrase sets to return.
The service may return fewer than this value. If
Expand Down Expand Up @@ -239,8 +239,8 @@ class CreateCustomClassRequest(proto.Message):
(US North America), and ``eu`` (Europe). If you are calling
the ``speech.googleapis.com`` endpoint, use the ``global``
location. To specify a region, use a `regional
endpoint </speech-to-text/docs/endpoints>`__ with matching
``us`` or ``eu`` location value.
endpoint <https://cloud.google.com/speech-to-text/docs/endpoints>`__
with matching ``us`` or ``eu`` location value.
custom_class_id (str):
Required. The ID to use for the custom class, which will
become the final component of the custom class' resource
Expand Down Expand Up @@ -283,8 +283,8 @@ class UpdateCustomClassRequest(proto.Message):
(US North America), and ``eu`` (Europe). If you are calling
the ``speech.googleapis.com`` endpoint, use the ``global``
location. To specify a region, use a `regional
endpoint </speech-to-text/docs/endpoints>`__ with matching
``us`` or ``eu`` location value.
endpoint <https://cloud.google.com/speech-to-text/docs/endpoints>`__
with matching ``us`` or ``eu`` location value.
update_mask (google.protobuf.field_mask_pb2.FieldMask):
The list of fields to be updated.
"""
Expand Down Expand Up @@ -331,8 +331,8 @@ class ListCustomClassesRequest(proto.Message):
(US North America), and ``eu`` (Europe). If you are calling
the ``speech.googleapis.com`` endpoint, use the ``global``
location. To specify a region, use a `regional
endpoint </speech-to-text/docs/endpoints>`__ with matching
``us`` or ``eu`` location value.
endpoint <https://cloud.google.com/speech-to-text/docs/endpoints>`__
with matching ``us`` or ``eu`` location value.
page_size (int):
The maximum number of custom classes to
return. The service may return fewer than this
Expand Down Expand Up @@ -402,8 +402,8 @@ class DeleteCustomClassRequest(proto.Message):
(US North America), and ``eu`` (Europe). If you are calling
the ``speech.googleapis.com`` endpoint, use the ``global``
location. To specify a region, use a `regional
endpoint </speech-to-text/docs/endpoints>`__ with matching
``us`` or ``eu`` location value.
endpoint <https://cloud.google.com/speech-to-text/docs/endpoints>`__
with matching ``us`` or ``eu`` location value.
"""

name = proto.Field(
Expand Down
54 changes: 37 additions & 17 deletions tests/unit/gapic/speech_v1/test_speech.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,24 +87,24 @@ def test__get_default_mtls_endpoint():


@pytest.mark.parametrize(
"client_class",
"client_class,transport_name",
[
SpeechClient,
SpeechAsyncClient,
(SpeechClient, "grpc"),
(SpeechAsyncClient, "grpc_asyncio"),
],
)
def test_speech_client_from_service_account_info(client_class):
def test_speech_client_from_service_account_info(client_class, transport_name):
creds = ga_credentials.AnonymousCredentials()
with mock.patch.object(
service_account.Credentials, "from_service_account_info"
) as factory:
factory.return_value = creds
info = {"valid": True}
client = client_class.from_service_account_info(info)
client = client_class.from_service_account_info(info, transport=transport_name)
assert client.transport._credentials == creds
assert isinstance(client, client_class)

assert client.transport._host == "speech.googleapis.com:443"
assert client.transport._host == ("speech.googleapis.com:443")


@pytest.mark.parametrize(
Expand All @@ -131,27 +131,31 @@ def test_speech_client_service_account_always_use_jwt(transport_class, transport


@pytest.mark.parametrize(
"client_class",
"client_class,transport_name",
[
SpeechClient,
SpeechAsyncClient,
(SpeechClient, "grpc"),
(SpeechAsyncClient, "grpc_asyncio"),
],
)
def test_speech_client_from_service_account_file(client_class):
def test_speech_client_from_service_account_file(client_class, transport_name):
creds = ga_credentials.AnonymousCredentials()
with mock.patch.object(
service_account.Credentials, "from_service_account_file"
) as factory:
factory.return_value = creds
client = client_class.from_service_account_file("dummy/file/path.json")
client = client_class.from_service_account_file(
"dummy/file/path.json", transport=transport_name
)
assert client.transport._credentials == creds
assert isinstance(client, client_class)

client = client_class.from_service_account_json("dummy/file/path.json")
client = client_class.from_service_account_json(
"dummy/file/path.json", transport=transport_name
)
assert client.transport._credentials == creds
assert isinstance(client, client_class)

assert client.transport._host == "speech.googleapis.com:443"
assert client.transport._host == ("speech.googleapis.com:443")


def test_speech_client_get_transport_class():
Expand Down Expand Up @@ -1348,24 +1352,40 @@ def test_speech_grpc_transport_client_cert_source_for_mtls(transport_class):
)


def test_speech_host_no_port():
@pytest.mark.parametrize(
"transport_name",
[
"grpc",
"grpc_asyncio",
],
)
def test_speech_host_no_port(transport_name):
client = SpeechClient(
credentials=ga_credentials.AnonymousCredentials(),
client_options=client_options.ClientOptions(
api_endpoint="speech.googleapis.com"
),
transport=transport_name,
)
assert client.transport._host == "speech.googleapis.com:443"
assert client.transport._host == ("speech.googleapis.com:443")


def test_speech_host_with_port():
@pytest.mark.parametrize(
"transport_name",
[
"grpc",
"grpc_asyncio",
],
)
def test_speech_host_with_port(transport_name):
client = SpeechClient(
credentials=ga_credentials.AnonymousCredentials(),
client_options=client_options.ClientOptions(
api_endpoint="speech.googleapis.com:8000"
),
transport=transport_name,
)
assert client.transport._host == "speech.googleapis.com:8000"
assert client.transport._host == ("speech.googleapis.com:8000")


def test_speech_grpc_transport_channel():
Expand Down
Loading