From 7bb1904ac826460dcbe64ac8e5ef3cb2d220a92f Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 9 Nov 2021 19:14:26 -0500 Subject: [PATCH] chore: use gapic-generator-python 0.56.2 (#219) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: update Java and Python dependencies PiperOrigin-RevId: 408420890 Source-Link: https://github.com/googleapis/googleapis/commit/2921f9fb3bfbd16f6b2da0104373e2b47a80a65e Source-Link: https://github.com/googleapis/googleapis-gen/commit/6598ca8cbbf5226733a099c4506518a5af6ff74c Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNjU5OGNhOGNiYmY1MjI2NzMzYTA5OWM0NTA2NTE4YTVhZjZmZjc0YyJ9 * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .../services/language_service/async_client.py | 13 ++- .../services/language_service/client.py | 25 +++-- .../language_service/transports/base.py | 8 +- .../language_service/transports/grpc.py | 4 +- .../transports/grpc_asyncio.py | 4 +- .../language_v1/types/language_service.py | 2 + .../services/language_service/async_client.py | 13 ++- .../services/language_service/client.py | 25 +++-- .../language_service/transports/base.py | 8 +- .../language_service/transports/grpc.py | 4 +- .../transports/grpc_asyncio.py | 4 +- .../types/language_service.py | 2 + .../language_v1/test_language_service.py | 100 +++++++++++++----- .../language_v1beta2/test_language_service.py | 100 +++++++++++++----- 14 files changed, 214 insertions(+), 98 deletions(-) diff --git a/packages/google-cloud-language/google/cloud/language_v1/services/language_service/async_client.py b/packages/google-cloud-language/google/cloud/language_v1/services/language_service/async_client.py index 04146200b86b..8121cc51ee0c 100644 --- a/packages/google-cloud-language/google/cloud/language_v1/services/language_service/async_client.py +++ b/packages/google-cloud-language/google/cloud/language_v1/services/language_service/async_client.py @@ -19,14 +19,17 @@ from typing import Dict, Sequence, Tuple, Type, Union import pkg_resources -from google.api_core.client_options import ClientOptions # type: ignore -from google.api_core import exceptions as core_exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore +from google.api_core.client_options import ClientOptions +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore -OptionalRetry = Union[retries.Retry, object] +try: + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object] # type: ignore from google.cloud.language_v1.types import language_service from .transports.base import LanguageServiceTransport, DEFAULT_CLIENT_INFO diff --git a/packages/google-cloud-language/google/cloud/language_v1/services/language_service/client.py b/packages/google-cloud-language/google/cloud/language_v1/services/language_service/client.py index d2ec0b8e9e69..ea4653b1cca6 100644 --- a/packages/google-cloud-language/google/cloud/language_v1/services/language_service/client.py +++ b/packages/google-cloud-language/google/cloud/language_v1/services/language_service/client.py @@ -14,23 +14,25 @@ # limitations under the License. # from collections import OrderedDict -from distutils import util import os import re from typing import Dict, Optional, Sequence, Tuple, Type, Union import pkg_resources -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions as core_exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore +from google.api_core import client_options as client_options_lib +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport import mtls # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore -OptionalRetry = Union[retries.Retry, object] +try: + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object] # type: ignore from google.cloud.language_v1.types import language_service from .transports.base import LanguageServiceTransport, DEFAULT_CLIENT_INFO @@ -268,8 +270,15 @@ def __init__( client_options = client_options_lib.ClientOptions() # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")) + if os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") not in ( + "true", + "false", + ): + raise ValueError( + "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" + ) + use_client_cert = ( + os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") == "true" ) client_cert_source_func = None diff --git a/packages/google-cloud-language/google/cloud/language_v1/services/language_service/transports/base.py b/packages/google-cloud-language/google/cloud/language_v1/services/language_service/transports/base.py index b38a9acfea24..8aedbe77ad84 100644 --- a/packages/google-cloud-language/google/cloud/language_v1/services/language_service/transports/base.py +++ b/packages/google-cloud-language/google/cloud/language_v1/services/language_service/transports/base.py @@ -18,10 +18,10 @@ import pkg_resources import google.auth # type: ignore -import google.api_core # type: ignore -from google.api_core import exceptions as core_exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore +import google.api_core +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore diff --git a/packages/google-cloud-language/google/cloud/language_v1/services/language_service/transports/grpc.py b/packages/google-cloud-language/google/cloud/language_v1/services/language_service/transports/grpc.py index 4a85b2e2a212..94941e4e8e88 100644 --- a/packages/google-cloud-language/google/cloud/language_v1/services/language_service/transports/grpc.py +++ b/packages/google-cloud-language/google/cloud/language_v1/services/language_service/transports/grpc.py @@ -16,8 +16,8 @@ import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore +from google.api_core import grpc_helpers +from google.api_core import gapic_v1 import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore diff --git a/packages/google-cloud-language/google/cloud/language_v1/services/language_service/transports/grpc_asyncio.py b/packages/google-cloud-language/google/cloud/language_v1/services/language_service/transports/grpc_asyncio.py index a9292306679f..681336e2d3da 100644 --- a/packages/google-cloud-language/google/cloud/language_v1/services/language_service/transports/grpc_asyncio.py +++ b/packages/google-cloud-language/google/cloud/language_v1/services/language_service/transports/grpc_asyncio.py @@ -16,8 +16,8 @@ import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union -from google.api_core import gapic_v1 # type: ignore -from google.api_core import grpc_helpers_async # type: ignore +from google.api_core import gapic_v1 +from google.api_core import grpc_helpers_async from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore diff --git a/packages/google-cloud-language/google/cloud/language_v1/types/language_service.py b/packages/google-cloud-language/google/cloud/language_v1/types/language_service.py index c8beb931b11c..25a6fff4934b 100644 --- a/packages/google-cloud-language/google/cloud/language_v1/types/language_service.py +++ b/packages/google-cloud-language/google/cloud/language_v1/types/language_service.py @@ -77,6 +77,7 @@ class Document(proto.Message): The content of the input in string format. Cloud audit logging exempt since it is based on user data. + This field is a member of `oneof`_ ``source``. gcs_content_uri (str): The Google Cloud Storage URI where the file content is @@ -84,6 +85,7 @@ class Document(proto.Message): gs://bucket_name/object_name. For more details, see https://cloud.google.com/storage/docs/reference-uris. NOTE: Cloud Storage object versioning is not supported. + This field is a member of `oneof`_ ``source``. language (str): The language of the document (if not specified, the language diff --git a/packages/google-cloud-language/google/cloud/language_v1beta2/services/language_service/async_client.py b/packages/google-cloud-language/google/cloud/language_v1beta2/services/language_service/async_client.py index c3b06047ab48..366e2acf6cab 100644 --- a/packages/google-cloud-language/google/cloud/language_v1beta2/services/language_service/async_client.py +++ b/packages/google-cloud-language/google/cloud/language_v1beta2/services/language_service/async_client.py @@ -19,14 +19,17 @@ from typing import Dict, Sequence, Tuple, Type, Union import pkg_resources -from google.api_core.client_options import ClientOptions # type: ignore -from google.api_core import exceptions as core_exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore +from google.api_core.client_options import ClientOptions +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore -OptionalRetry = Union[retries.Retry, object] +try: + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object] # type: ignore from google.cloud.language_v1beta2.types import language_service from .transports.base import LanguageServiceTransport, DEFAULT_CLIENT_INFO diff --git a/packages/google-cloud-language/google/cloud/language_v1beta2/services/language_service/client.py b/packages/google-cloud-language/google/cloud/language_v1beta2/services/language_service/client.py index e2a0de6e0cb6..29fd4df70820 100644 --- a/packages/google-cloud-language/google/cloud/language_v1beta2/services/language_service/client.py +++ b/packages/google-cloud-language/google/cloud/language_v1beta2/services/language_service/client.py @@ -14,23 +14,25 @@ # limitations under the License. # from collections import OrderedDict -from distutils import util import os import re from typing import Dict, Optional, Sequence, Tuple, Type, Union import pkg_resources -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions as core_exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore +from google.api_core import client_options as client_options_lib +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport import mtls # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore -OptionalRetry = Union[retries.Retry, object] +try: + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object] # type: ignore from google.cloud.language_v1beta2.types import language_service from .transports.base import LanguageServiceTransport, DEFAULT_CLIENT_INFO @@ -268,8 +270,15 @@ def __init__( client_options = client_options_lib.ClientOptions() # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")) + if os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") not in ( + "true", + "false", + ): + raise ValueError( + "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" + ) + use_client_cert = ( + os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") == "true" ) client_cert_source_func = None diff --git a/packages/google-cloud-language/google/cloud/language_v1beta2/services/language_service/transports/base.py b/packages/google-cloud-language/google/cloud/language_v1beta2/services/language_service/transports/base.py index 99b2bd55acf0..5a7f54c78759 100644 --- a/packages/google-cloud-language/google/cloud/language_v1beta2/services/language_service/transports/base.py +++ b/packages/google-cloud-language/google/cloud/language_v1beta2/services/language_service/transports/base.py @@ -18,10 +18,10 @@ import pkg_resources import google.auth # type: ignore -import google.api_core # type: ignore -from google.api_core import exceptions as core_exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore +import google.api_core +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore diff --git a/packages/google-cloud-language/google/cloud/language_v1beta2/services/language_service/transports/grpc.py b/packages/google-cloud-language/google/cloud/language_v1beta2/services/language_service/transports/grpc.py index 7f7c7b2d0b32..2936db357eaa 100644 --- a/packages/google-cloud-language/google/cloud/language_v1beta2/services/language_service/transports/grpc.py +++ b/packages/google-cloud-language/google/cloud/language_v1beta2/services/language_service/transports/grpc.py @@ -16,8 +16,8 @@ import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore +from google.api_core import grpc_helpers +from google.api_core import gapic_v1 import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore diff --git a/packages/google-cloud-language/google/cloud/language_v1beta2/services/language_service/transports/grpc_asyncio.py b/packages/google-cloud-language/google/cloud/language_v1beta2/services/language_service/transports/grpc_asyncio.py index 331a9b1b2781..5e7e6213cc07 100644 --- a/packages/google-cloud-language/google/cloud/language_v1beta2/services/language_service/transports/grpc_asyncio.py +++ b/packages/google-cloud-language/google/cloud/language_v1beta2/services/language_service/transports/grpc_asyncio.py @@ -16,8 +16,8 @@ import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union -from google.api_core import gapic_v1 # type: ignore -from google.api_core import grpc_helpers_async # type: ignore +from google.api_core import gapic_v1 +from google.api_core import grpc_helpers_async from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore diff --git a/packages/google-cloud-language/google/cloud/language_v1beta2/types/language_service.py b/packages/google-cloud-language/google/cloud/language_v1beta2/types/language_service.py index 840ae888aa16..68f9297b07f9 100644 --- a/packages/google-cloud-language/google/cloud/language_v1beta2/types/language_service.py +++ b/packages/google-cloud-language/google/cloud/language_v1beta2/types/language_service.py @@ -77,6 +77,7 @@ class Document(proto.Message): The content of the input in string format. Cloud audit logging exempt since it is based on user data. + This field is a member of `oneof`_ ``source``. gcs_content_uri (str): The Google Cloud Storage URI where the file content is @@ -84,6 +85,7 @@ class Document(proto.Message): gs://bucket_name/object_name. For more details, see https://cloud.google.com/storage/docs/reference-uris. NOTE: Cloud Storage object versioning is not supported. + This field is a member of `oneof`_ ``source``. language (str): The language of the document (if not specified, the language diff --git a/packages/google-cloud-language/tests/unit/gapic/language_v1/test_language_service.py b/packages/google-cloud-language/tests/unit/gapic/language_v1/test_language_service.py index 9be55b985114..2956a9c10ba3 100644 --- a/packages/google-cloud-language/tests/unit/gapic/language_v1/test_language_service.py +++ b/packages/google-cloud-language/tests/unit/gapic/language_v1/test_language_service.py @@ -600,10 +600,14 @@ def test_analyze_sentiment_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].document == language_service.Document( + arg = args[0].document + mock_val = language_service.Document( type_=language_service.Document.Type.PLAIN_TEXT ) - assert args[0].encoding_type == language_service.EncodingType.UTF8 + assert arg == mock_val + arg = args[0].encoding_type + mock_val = language_service.EncodingType.UTF8 + assert arg == mock_val def test_analyze_sentiment_flattened_error(): @@ -650,10 +654,14 @@ async def test_analyze_sentiment_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].document == language_service.Document( + arg = args[0].document + mock_val = language_service.Document( type_=language_service.Document.Type.PLAIN_TEXT ) - assert args[0].encoding_type == language_service.EncodingType.UTF8 + assert arg == mock_val + arg = args[0].encoding_type + mock_val = language_service.EncodingType.UTF8 + assert arg == mock_val @pytest.mark.asyncio @@ -778,10 +786,14 @@ def test_analyze_entities_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].document == language_service.Document( + arg = args[0].document + mock_val = language_service.Document( type_=language_service.Document.Type.PLAIN_TEXT ) - assert args[0].encoding_type == language_service.EncodingType.UTF8 + assert arg == mock_val + arg = args[0].encoding_type + mock_val = language_service.EncodingType.UTF8 + assert arg == mock_val def test_analyze_entities_flattened_error(): @@ -826,10 +838,14 @@ async def test_analyze_entities_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].document == language_service.Document( + arg = args[0].document + mock_val = language_service.Document( type_=language_service.Document.Type.PLAIN_TEXT ) - assert args[0].encoding_type == language_service.EncodingType.UTF8 + assert arg == mock_val + arg = args[0].encoding_type + mock_val = language_service.EncodingType.UTF8 + assert arg == mock_val @pytest.mark.asyncio @@ -962,10 +978,14 @@ def test_analyze_entity_sentiment_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].document == language_service.Document( + arg = args[0].document + mock_val = language_service.Document( type_=language_service.Document.Type.PLAIN_TEXT ) - assert args[0].encoding_type == language_service.EncodingType.UTF8 + assert arg == mock_val + arg = args[0].encoding_type + mock_val = language_service.EncodingType.UTF8 + assert arg == mock_val def test_analyze_entity_sentiment_flattened_error(): @@ -1012,10 +1032,14 @@ async def test_analyze_entity_sentiment_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].document == language_service.Document( + arg = args[0].document + mock_val = language_service.Document( type_=language_service.Document.Type.PLAIN_TEXT ) - assert args[0].encoding_type == language_service.EncodingType.UTF8 + assert arg == mock_val + arg = args[0].encoding_type + mock_val = language_service.EncodingType.UTF8 + assert arg == mock_val @pytest.mark.asyncio @@ -1139,10 +1163,14 @@ def test_analyze_syntax_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].document == language_service.Document( + arg = args[0].document + mock_val = language_service.Document( type_=language_service.Document.Type.PLAIN_TEXT ) - assert args[0].encoding_type == language_service.EncodingType.UTF8 + assert arg == mock_val + arg = args[0].encoding_type + mock_val = language_service.EncodingType.UTF8 + assert arg == mock_val def test_analyze_syntax_flattened_error(): @@ -1187,10 +1215,14 @@ async def test_analyze_syntax_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].document == language_service.Document( + arg = args[0].document + mock_val = language_service.Document( type_=language_service.Document.Type.PLAIN_TEXT ) - assert args[0].encoding_type == language_service.EncodingType.UTF8 + assert arg == mock_val + arg = args[0].encoding_type + mock_val = language_service.EncodingType.UTF8 + assert arg == mock_val @pytest.mark.asyncio @@ -1309,9 +1341,11 @@ def test_classify_text_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].document == language_service.Document( + arg = args[0].document + mock_val = language_service.Document( type_=language_service.Document.Type.PLAIN_TEXT ) + assert arg == mock_val def test_classify_text_flattened_error(): @@ -1354,9 +1388,11 @@ async def test_classify_text_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].document == language_service.Document( + arg = args[0].document + mock_val = language_service.Document( type_=language_service.Document.Type.PLAIN_TEXT ) + assert arg == mock_val @pytest.mark.asyncio @@ -1480,13 +1516,17 @@ def test_annotate_text_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].document == language_service.Document( + arg = args[0].document + mock_val = language_service.Document( type_=language_service.Document.Type.PLAIN_TEXT ) - assert args[0].features == language_service.AnnotateTextRequest.Features( - extract_syntax=True - ) - assert args[0].encoding_type == language_service.EncodingType.UTF8 + assert arg == mock_val + arg = args[0].features + mock_val = language_service.AnnotateTextRequest.Features(extract_syntax=True) + assert arg == mock_val + arg = args[0].encoding_type + mock_val = language_service.EncodingType.UTF8 + assert arg == mock_val def test_annotate_text_flattened_error(): @@ -1533,13 +1573,17 @@ async def test_annotate_text_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].document == language_service.Document( + arg = args[0].document + mock_val = language_service.Document( type_=language_service.Document.Type.PLAIN_TEXT ) - assert args[0].features == language_service.AnnotateTextRequest.Features( - extract_syntax=True - ) - assert args[0].encoding_type == language_service.EncodingType.UTF8 + assert arg == mock_val + arg = args[0].features + mock_val = language_service.AnnotateTextRequest.Features(extract_syntax=True) + assert arg == mock_val + arg = args[0].encoding_type + mock_val = language_service.EncodingType.UTF8 + assert arg == mock_val @pytest.mark.asyncio diff --git a/packages/google-cloud-language/tests/unit/gapic/language_v1beta2/test_language_service.py b/packages/google-cloud-language/tests/unit/gapic/language_v1beta2/test_language_service.py index 5b0fd6598f04..703d778fbe93 100644 --- a/packages/google-cloud-language/tests/unit/gapic/language_v1beta2/test_language_service.py +++ b/packages/google-cloud-language/tests/unit/gapic/language_v1beta2/test_language_service.py @@ -602,10 +602,14 @@ def test_analyze_sentiment_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].document == language_service.Document( + arg = args[0].document + mock_val = language_service.Document( type_=language_service.Document.Type.PLAIN_TEXT ) - assert args[0].encoding_type == language_service.EncodingType.UTF8 + assert arg == mock_val + arg = args[0].encoding_type + mock_val = language_service.EncodingType.UTF8 + assert arg == mock_val def test_analyze_sentiment_flattened_error(): @@ -652,10 +656,14 @@ async def test_analyze_sentiment_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].document == language_service.Document( + arg = args[0].document + mock_val = language_service.Document( type_=language_service.Document.Type.PLAIN_TEXT ) - assert args[0].encoding_type == language_service.EncodingType.UTF8 + assert arg == mock_val + arg = args[0].encoding_type + mock_val = language_service.EncodingType.UTF8 + assert arg == mock_val @pytest.mark.asyncio @@ -780,10 +788,14 @@ def test_analyze_entities_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].document == language_service.Document( + arg = args[0].document + mock_val = language_service.Document( type_=language_service.Document.Type.PLAIN_TEXT ) - assert args[0].encoding_type == language_service.EncodingType.UTF8 + assert arg == mock_val + arg = args[0].encoding_type + mock_val = language_service.EncodingType.UTF8 + assert arg == mock_val def test_analyze_entities_flattened_error(): @@ -828,10 +840,14 @@ async def test_analyze_entities_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].document == language_service.Document( + arg = args[0].document + mock_val = language_service.Document( type_=language_service.Document.Type.PLAIN_TEXT ) - assert args[0].encoding_type == language_service.EncodingType.UTF8 + assert arg == mock_val + arg = args[0].encoding_type + mock_val = language_service.EncodingType.UTF8 + assert arg == mock_val @pytest.mark.asyncio @@ -964,10 +980,14 @@ def test_analyze_entity_sentiment_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].document == language_service.Document( + arg = args[0].document + mock_val = language_service.Document( type_=language_service.Document.Type.PLAIN_TEXT ) - assert args[0].encoding_type == language_service.EncodingType.UTF8 + assert arg == mock_val + arg = args[0].encoding_type + mock_val = language_service.EncodingType.UTF8 + assert arg == mock_val def test_analyze_entity_sentiment_flattened_error(): @@ -1014,10 +1034,14 @@ async def test_analyze_entity_sentiment_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].document == language_service.Document( + arg = args[0].document + mock_val = language_service.Document( type_=language_service.Document.Type.PLAIN_TEXT ) - assert args[0].encoding_type == language_service.EncodingType.UTF8 + assert arg == mock_val + arg = args[0].encoding_type + mock_val = language_service.EncodingType.UTF8 + assert arg == mock_val @pytest.mark.asyncio @@ -1141,10 +1165,14 @@ def test_analyze_syntax_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].document == language_service.Document( + arg = args[0].document + mock_val = language_service.Document( type_=language_service.Document.Type.PLAIN_TEXT ) - assert args[0].encoding_type == language_service.EncodingType.UTF8 + assert arg == mock_val + arg = args[0].encoding_type + mock_val = language_service.EncodingType.UTF8 + assert arg == mock_val def test_analyze_syntax_flattened_error(): @@ -1189,10 +1217,14 @@ async def test_analyze_syntax_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].document == language_service.Document( + arg = args[0].document + mock_val = language_service.Document( type_=language_service.Document.Type.PLAIN_TEXT ) - assert args[0].encoding_type == language_service.EncodingType.UTF8 + assert arg == mock_val + arg = args[0].encoding_type + mock_val = language_service.EncodingType.UTF8 + assert arg == mock_val @pytest.mark.asyncio @@ -1311,9 +1343,11 @@ def test_classify_text_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].document == language_service.Document( + arg = args[0].document + mock_val = language_service.Document( type_=language_service.Document.Type.PLAIN_TEXT ) + assert arg == mock_val def test_classify_text_flattened_error(): @@ -1356,9 +1390,11 @@ async def test_classify_text_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].document == language_service.Document( + arg = args[0].document + mock_val = language_service.Document( type_=language_service.Document.Type.PLAIN_TEXT ) + assert arg == mock_val @pytest.mark.asyncio @@ -1482,13 +1518,17 @@ def test_annotate_text_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].document == language_service.Document( + arg = args[0].document + mock_val = language_service.Document( type_=language_service.Document.Type.PLAIN_TEXT ) - assert args[0].features == language_service.AnnotateTextRequest.Features( - extract_syntax=True - ) - assert args[0].encoding_type == language_service.EncodingType.UTF8 + assert arg == mock_val + arg = args[0].features + mock_val = language_service.AnnotateTextRequest.Features(extract_syntax=True) + assert arg == mock_val + arg = args[0].encoding_type + mock_val = language_service.EncodingType.UTF8 + assert arg == mock_val def test_annotate_text_flattened_error(): @@ -1535,13 +1575,17 @@ async def test_annotate_text_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].document == language_service.Document( + arg = args[0].document + mock_val = language_service.Document( type_=language_service.Document.Type.PLAIN_TEXT ) - assert args[0].features == language_service.AnnotateTextRequest.Features( - extract_syntax=True - ) - assert args[0].encoding_type == language_service.EncodingType.UTF8 + assert arg == mock_val + arg = args[0].features + mock_val = language_service.AnnotateTextRequest.Features(extract_syntax=True) + assert arg == mock_val + arg = args[0].encoding_type + mock_val = language_service.EncodingType.UTF8 + assert arg == mock_val @pytest.mark.asyncio