From b9c7adc79969494c2aff7491b98eee921df94473 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 28 Mar 2022 23:56:18 +0000 Subject: [PATCH] chore(python): use black==22.3.0 (#95) Source-Link: https://github.com/googleapis/synthtool/commit/6fab84af09f2cf89a031fd8671d1def6b2931b11 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:7cffbc10910c3ab1b852c05114a08d374c195a81cdec1d4a67a1d129331d0bfe --- .../.github/.OwlBot.lock.yaml | 2 +- .../google-cloud-private-catalog/docs/conf.py | 5 +- .../services/private_catalog/async_client.py | 36 +- .../services/private_catalog/client.py | 103 ++++- .../private_catalog/transports/base.py | 18 +- .../private_catalog/transports/grpc.py | 3 +- .../types/private_catalog.py | 297 ++++++++++--- .../google-cloud-private-catalog/noxfile.py | 9 +- .../test_private_catalog.py | 408 ++++++++++++++---- 9 files changed, 691 insertions(+), 190 deletions(-) diff --git a/packages/google-cloud-private-catalog/.github/.OwlBot.lock.yaml b/packages/google-cloud-private-catalog/.github/.OwlBot.lock.yaml index 44c78f7cc12d..87dd00611576 100644 --- a/packages/google-cloud-private-catalog/.github/.OwlBot.lock.yaml +++ b/packages/google-cloud-private-catalog/.github/.OwlBot.lock.yaml @@ -13,4 +13,4 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:4e1991042fe54b991db9ca17c8fb386e61b22fe4d1472a568bf0fcac85dcf5d3 + digest: sha256:7cffbc10910c3ab1b852c05114a08d374c195a81cdec1d4a67a1d129331d0bfe diff --git a/packages/google-cloud-private-catalog/docs/conf.py b/packages/google-cloud-private-catalog/docs/conf.py index 9eeaeae345c9..d26fb56fdda5 100644 --- a/packages/google-cloud-private-catalog/docs/conf.py +++ b/packages/google-cloud-private-catalog/docs/conf.py @@ -361,7 +361,10 @@ intersphinx_mapping = { "python": ("https://python.readthedocs.org/en/latest/", None), "google-auth": ("https://googleapis.dev/python/google-auth/latest/", None), - "google.api_core": ("https://googleapis.dev/python/google-api-core/latest/", None,), + "google.api_core": ( + "https://googleapis.dev/python/google-api-core/latest/", + None, + ), "grpc": ("https://grpc.github.io/grpc/python/", None), "proto-plus": ("https://proto-plus-python.readthedocs.io/en/latest/", None), "protobuf": ("https://googleapis.dev/python/protobuf/latest/", None), diff --git a/packages/google-cloud-private-catalog/google/cloud/privatecatalog_v1beta1/services/private_catalog/async_client.py b/packages/google-cloud-private-catalog/google/cloud/privatecatalog_v1beta1/services/private_catalog/async_client.py index 5b2353792602..35508c369d6b 100644 --- a/packages/google-cloud-private-catalog/google/cloud/privatecatalog_v1beta1/services/private_catalog/async_client.py +++ b/packages/google-cloud-private-catalog/google/cloud/privatecatalog_v1beta1/services/private_catalog/async_client.py @@ -298,12 +298,20 @@ def sample_search_catalogs(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.SearchCatalogsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -379,12 +387,20 @@ def sample_search_products(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.SearchProductsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -461,12 +477,20 @@ def sample_search_versions(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.SearchVersionsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. diff --git a/packages/google-cloud-private-catalog/google/cloud/privatecatalog_v1beta1/services/private_catalog/client.py b/packages/google-cloud-private-catalog/google/cloud/privatecatalog_v1beta1/services/private_catalog/client.py index 11e64e52e363..1c76cb272d1d 100644 --- a/packages/google-cloud-private-catalog/google/cloud/privatecatalog_v1beta1/services/private_catalog/client.py +++ b/packages/google-cloud-private-catalog/google/cloud/privatecatalog_v1beta1/services/private_catalog/client.py @@ -55,7 +55,10 @@ class PrivateCatalogClientMeta(type): _transport_registry["grpc"] = PrivateCatalogGrpcTransport _transport_registry["grpc_asyncio"] = PrivateCatalogGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[PrivateCatalogTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[PrivateCatalogTransport]: """Returns an appropriate transport class. Args: @@ -182,9 +185,13 @@ def transport(self) -> PrivateCatalogTransport: return self._transport @staticmethod - def catalog_path(catalog: str,) -> str: + def catalog_path( + catalog: str, + ) -> str: """Returns a fully-qualified catalog string.""" - return "catalogs/{catalog}".format(catalog=catalog,) + return "catalogs/{catalog}".format( + catalog=catalog, + ) @staticmethod def parse_catalog_path(path: str) -> Dict[str, str]: @@ -193,9 +200,13 @@ def parse_catalog_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def product_path(product: str,) -> str: + def product_path( + product: str, + ) -> str: """Returns a fully-qualified product string.""" - return "products/{product}".format(product=product,) + return "products/{product}".format( + product=product, + ) @staticmethod def parse_product_path(path: str) -> Dict[str, str]: @@ -204,10 +215,16 @@ def parse_product_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def version_path(catalog: str, product: str, version: str,) -> str: + def version_path( + catalog: str, + product: str, + version: str, + ) -> str: """Returns a fully-qualified version string.""" return "catalogs/{catalog}/products/{product}/versions/{version}".format( - catalog=catalog, product=product, version=version, + catalog=catalog, + product=product, + version=version, ) @staticmethod @@ -220,7 +237,9 @@ def parse_version_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -233,9 +252,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -244,9 +267,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -255,9 +282,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -266,10 +297,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -514,12 +549,20 @@ def sample_search_catalogs(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.SearchCatalogsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -596,12 +639,20 @@ def sample_search_products(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.SearchProductsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -679,12 +730,20 @@ def sample_search_versions(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.SearchVersionsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. diff --git a/packages/google-cloud-private-catalog/google/cloud/privatecatalog_v1beta1/services/private_catalog/transports/base.py b/packages/google-cloud-private-catalog/google/cloud/privatecatalog_v1beta1/services/private_catalog/transports/base.py index 1c30953b41eb..5858c4497216 100644 --- a/packages/google-cloud-private-catalog/google/cloud/privatecatalog_v1beta1/services/private_catalog/transports/base.py +++ b/packages/google-cloud-private-catalog/google/cloud/privatecatalog_v1beta1/services/private_catalog/transports/base.py @@ -121,22 +121,28 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.search_catalogs: gapic_v1.method.wrap_method( - self.search_catalogs, default_timeout=None, client_info=client_info, + self.search_catalogs, + default_timeout=None, + client_info=client_info, ), self.search_products: gapic_v1.method.wrap_method( - self.search_products, default_timeout=None, client_info=client_info, + self.search_products, + default_timeout=None, + client_info=client_info, ), self.search_versions: gapic_v1.method.wrap_method( - self.search_versions, default_timeout=None, client_info=client_info, + self.search_versions, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/packages/google-cloud-private-catalog/google/cloud/privatecatalog_v1beta1/services/private_catalog/transports/grpc.py b/packages/google-cloud-private-catalog/google/cloud/privatecatalog_v1beta1/services/private_catalog/transports/grpc.py index edd6d52ad517..2611da654ba4 100644 --- a/packages/google-cloud-private-catalog/google/cloud/privatecatalog_v1beta1/services/private_catalog/transports/grpc.py +++ b/packages/google-cloud-private-catalog/google/cloud/privatecatalog_v1beta1/services/private_catalog/transports/grpc.py @@ -245,8 +245,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property diff --git a/packages/google-cloud-private-catalog/google/cloud/privatecatalog_v1beta1/types/private_catalog.py b/packages/google-cloud-private-catalog/google/cloud/privatecatalog_v1beta1/types/private_catalog.py index d54969b51ed6..411762b9b709 100644 --- a/packages/google-cloud-private-catalog/google/cloud/privatecatalog_v1beta1/types/private_catalog.py +++ b/packages/google-cloud-private-catalog/google/cloud/privatecatalog_v1beta1/types/private_catalog.py @@ -65,10 +65,22 @@ class SearchCatalogsRequest(proto.Message): listing should continue from. """ - resource = proto.Field(proto.STRING, number=1,) - query = proto.Field(proto.STRING, number=2,) - page_size = proto.Field(proto.INT32, number=3,) - page_token = proto.Field(proto.STRING, number=4,) + resource = proto.Field( + proto.STRING, + number=1, + ) + query = proto.Field( + proto.STRING, + number=2, + ) + page_size = proto.Field( + proto.INT32, + number=3, + ) + page_token = proto.Field( + proto.STRING, + number=4, + ) class SearchCatalogsResponse(proto.Message): @@ -88,8 +100,15 @@ class SearchCatalogsResponse(proto.Message): def raw_page(self): return self - catalogs = proto.RepeatedField(proto.MESSAGE, number=1, message="Catalog",) - next_page_token = proto.Field(proto.STRING, number=2,) + catalogs = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Catalog", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) class SearchProductsRequest(proto.Message): @@ -120,10 +139,22 @@ class SearchProductsRequest(proto.Message): listing should continue from. """ - resource = proto.Field(proto.STRING, number=1,) - query = proto.Field(proto.STRING, number=2,) - page_size = proto.Field(proto.INT32, number=3,) - page_token = proto.Field(proto.STRING, number=4,) + resource = proto.Field( + proto.STRING, + number=1, + ) + query = proto.Field( + proto.STRING, + number=2, + ) + page_size = proto.Field( + proto.INT32, + number=3, + ) + page_token = proto.Field( + proto.STRING, + number=4, + ) class SearchProductsResponse(proto.Message): @@ -144,8 +175,15 @@ class SearchProductsResponse(proto.Message): def raw_page(self): return self - products = proto.RepeatedField(proto.MESSAGE, number=1, message="Product",) - next_page_token = proto.Field(proto.STRING, number=2,) + products = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Product", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) class SearchVersionsRequest(proto.Message): @@ -175,10 +213,22 @@ class SearchVersionsRequest(proto.Message): listing should continue from. """ - resource = proto.Field(proto.STRING, number=1,) - query = proto.Field(proto.STRING, number=2,) - page_size = proto.Field(proto.INT32, number=3,) - page_token = proto.Field(proto.STRING, number=4,) + resource = proto.Field( + proto.STRING, + number=1, + ) + query = proto.Field( + proto.STRING, + number=2, + ) + page_size = proto.Field( + proto.INT32, + number=3, + ) + page_token = proto.Field( + proto.STRING, + number=4, + ) class SearchVersionsResponse(proto.Message): @@ -199,8 +249,15 @@ class SearchVersionsResponse(proto.Message): def raw_page(self): return self - versions = proto.RepeatedField(proto.MESSAGE, number=1, message="Version",) - next_page_token = proto.Field(proto.STRING, number=2,) + versions = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Version", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) class Catalog(proto.Message): @@ -224,11 +281,28 @@ class Catalog(proto.Message): last updated. """ - name = proto.Field(proto.STRING, number=1,) - display_name = proto.Field(proto.STRING, number=2,) - description = proto.Field(proto.STRING, number=3,) - create_time = proto.Field(proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp,) - update_time = proto.Field(proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp,) + name = proto.Field( + proto.STRING, + number=1, + ) + display_name = proto.Field( + proto.STRING, + number=2, + ) + description = proto.Field( + proto.STRING, + number=3, + ) + create_time = proto.Field( + proto.MESSAGE, + number=4, + message=timestamp_pb2.Timestamp, + ) + update_time = proto.Field( + proto.MESSAGE, + number=5, + message=timestamp_pb2.Timestamp, + ) class Product(proto.Message): @@ -422,15 +496,38 @@ class Product(proto.Message): last updated. """ - name = proto.Field(proto.STRING, number=1,) - asset_type = proto.Field(proto.STRING, number=2,) - display_metadata = proto.Field(proto.MESSAGE, number=3, message=struct_pb2.Struct,) - icon_uri = proto.Field(proto.STRING, number=4,) + name = proto.Field( + proto.STRING, + number=1, + ) + asset_type = proto.Field( + proto.STRING, + number=2, + ) + display_metadata = proto.Field( + proto.MESSAGE, + number=3, + message=struct_pb2.Struct, + ) + icon_uri = proto.Field( + proto.STRING, + number=4, + ) asset_references = proto.RepeatedField( - proto.MESSAGE, number=10, message="AssetReference", + proto.MESSAGE, + number=10, + message="AssetReference", + ) + create_time = proto.Field( + proto.MESSAGE, + number=5, + message=timestamp_pb2.Timestamp, + ) + update_time = proto.Field( + proto.MESSAGE, + number=6, + message=timestamp_pb2.Timestamp, ) - create_time = proto.Field(proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp,) - update_time = proto.Field(proto.MESSAGE, number=6, message=timestamp_pb2.Timestamp,) class AssetReference(proto.Message): @@ -492,26 +589,64 @@ class AssetValidationState(proto.Enum): VALID = 2 INVALID = 3 - id = proto.Field(proto.STRING, number=1,) - description = proto.Field(proto.STRING, number=2,) - inputs = proto.Field(proto.MESSAGE, number=6, message="Inputs",) - validation_status = proto.Field(proto.ENUM, number=7, enum=AssetValidationState,) + id = proto.Field( + proto.STRING, + number=1, + ) + description = proto.Field( + proto.STRING, + number=2, + ) + inputs = proto.Field( + proto.MESSAGE, + number=6, + message="Inputs", + ) + validation_status = proto.Field( + proto.ENUM, + number=7, + enum=AssetValidationState, + ) validation_operation = proto.Field( - proto.MESSAGE, number=8, message=operations_pb2.Operation, + proto.MESSAGE, + number=8, + message=operations_pb2.Operation, + ) + asset = proto.Field( + proto.STRING, + number=10, + oneof="source", + ) + gcs_path = proto.Field( + proto.STRING, + number=11, + oneof="source", ) - asset = proto.Field(proto.STRING, number=10, oneof="source",) - gcs_path = proto.Field(proto.STRING, number=11, oneof="source",) git_source = proto.Field( - proto.MESSAGE, number=15, oneof="source", message="GitSource", + proto.MESSAGE, + number=15, + oneof="source", + message="GitSource", + ) + gcs_source = proto.Field( + proto.MESSAGE, + number=16, + message="GcsSource", ) - gcs_source = proto.Field(proto.MESSAGE, number=16, message="GcsSource",) create_time = proto.Field( - proto.MESSAGE, number=12, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=12, + message=timestamp_pb2.Timestamp, ) update_time = proto.Field( - proto.MESSAGE, number=13, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=13, + message=timestamp_pb2.Timestamp, + ) + version = proto.Field( + proto.STRING, + number=14, ) - version = proto.Field(proto.STRING, number=14,) class Inputs(proto.Message): @@ -523,7 +658,11 @@ class Inputs(proto.Message): inputs and their formats. """ - parameters = proto.Field(proto.MESSAGE, number=1, message=struct_pb2.Struct,) + parameters = proto.Field( + proto.MESSAGE, + number=1, + message=struct_pb2.Struct, + ) class GcsSource(proto.Message): @@ -541,9 +680,19 @@ class GcsSource(proto.Message): metadata was last changed. """ - gcs_path = proto.Field(proto.STRING, number=1,) - generation = proto.Field(proto.INT64, number=2,) - update_time = proto.Field(proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp,) + gcs_path = proto.Field( + proto.STRING, + number=1, + ) + generation = proto.Field( + proto.INT64, + number=2, + ) + update_time = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, + ) class GitSource(proto.Message): @@ -580,11 +729,29 @@ class GitSource(proto.Message): This field is a member of `oneof`_ ``ref``. """ - repo = proto.Field(proto.STRING, number=1,) - dir_ = proto.Field(proto.STRING, number=2,) - commit = proto.Field(proto.STRING, number=3, oneof="ref",) - branch = proto.Field(proto.STRING, number=4, oneof="ref",) - tag = proto.Field(proto.STRING, number=5, oneof="ref",) + repo = proto.Field( + proto.STRING, + number=1, + ) + dir_ = proto.Field( + proto.STRING, + number=2, + ) + commit = proto.Field( + proto.STRING, + number=3, + oneof="ref", + ) + branch = proto.Field( + proto.STRING, + number=4, + oneof="ref", + ) + tag = proto.Field( + proto.STRING, + number=5, + oneof="ref", + ) class Version(proto.Message): @@ -613,11 +780,29 @@ class Version(proto.Message): last updated. """ - name = proto.Field(proto.STRING, number=1,) - description = proto.Field(proto.STRING, number=2,) - asset = proto.Field(proto.MESSAGE, number=3, message=struct_pb2.Struct,) - create_time = proto.Field(proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp,) - update_time = proto.Field(proto.MESSAGE, number=6, message=timestamp_pb2.Timestamp,) + name = proto.Field( + proto.STRING, + number=1, + ) + description = proto.Field( + proto.STRING, + number=2, + ) + asset = proto.Field( + proto.MESSAGE, + number=3, + message=struct_pb2.Struct, + ) + create_time = proto.Field( + proto.MESSAGE, + number=5, + message=timestamp_pb2.Timestamp, + ) + update_time = proto.Field( + proto.MESSAGE, + number=6, + message=timestamp_pb2.Timestamp, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/packages/google-cloud-private-catalog/noxfile.py b/packages/google-cloud-private-catalog/noxfile.py index 2a2001c49998..3addb4ed9431 100644 --- a/packages/google-cloud-private-catalog/noxfile.py +++ b/packages/google-cloud-private-catalog/noxfile.py @@ -24,7 +24,7 @@ import nox -BLACK_VERSION = "black==19.10b0" +BLACK_VERSION = "black==22.3.0" BLACK_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] DEFAULT_PYTHON_VERSION = "3.8" @@ -57,7 +57,9 @@ def lint(session): """ session.install("flake8", BLACK_VERSION) session.run( - "black", "--check", *BLACK_PATHS, + "black", + "--check", + *BLACK_PATHS, ) session.run("flake8", "google", "tests") @@ -67,7 +69,8 @@ def blacken(session): """Run black. Format code to uniform standard.""" session.install(BLACK_VERSION) session.run( - "black", *BLACK_PATHS, + "black", + *BLACK_PATHS, ) diff --git a/packages/google-cloud-private-catalog/tests/unit/gapic/privatecatalog_v1beta1/test_private_catalog.py b/packages/google-cloud-private-catalog/tests/unit/gapic/privatecatalog_v1beta1/test_private_catalog.py index d5473301c413..8e21c012404d 100644 --- a/packages/google-cloud-private-catalog/tests/unit/gapic/privatecatalog_v1beta1/test_private_catalog.py +++ b/packages/google-cloud-private-catalog/tests/unit/gapic/privatecatalog_v1beta1/test_private_catalog.py @@ -89,7 +89,11 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", [PrivateCatalogClient, PrivateCatalogAsyncClient,] + "client_class", + [ + PrivateCatalogClient, + PrivateCatalogAsyncClient, + ], ) def test_private_catalog_client_from_service_account_info(client_class): creds = ga_credentials.AnonymousCredentials() @@ -131,7 +135,11 @@ def test_private_catalog_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", [PrivateCatalogClient, PrivateCatalogAsyncClient,] + "client_class", + [ + PrivateCatalogClient, + PrivateCatalogAsyncClient, + ], ) def test_private_catalog_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() @@ -495,7 +503,9 @@ def test_private_catalog_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -635,10 +645,17 @@ def test_private_catalog_client_create_channel_credentials_file( ) -@pytest.mark.parametrize("request_type", [private_catalog.SearchCatalogsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + private_catalog.SearchCatalogsRequest, + dict, + ], +) def test_search_catalogs(request_type, transport: str = "grpc"): client = PrivateCatalogClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -667,7 +684,8 @@ def test_search_catalogs_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = PrivateCatalogClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -683,7 +701,8 @@ async def test_search_catalogs_async( transport: str = "grpc_asyncio", request_type=private_catalog.SearchCatalogsRequest ): client = PrivateCatalogAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -716,7 +735,9 @@ async def test_search_catalogs_async_from_dict(): def test_search_catalogs_field_headers(): - client = PrivateCatalogClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PrivateCatalogClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. @@ -736,7 +757,10 @@ def test_search_catalogs_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "resource=resource/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -765,12 +789,16 @@ async def test_search_catalogs_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "resource=resource/value", + ) in kw["metadata"] def test_search_catalogs_pager(transport_name: str = "grpc"): client = PrivateCatalogClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -785,12 +813,21 @@ def test_search_catalogs_pager(transport_name: str = "grpc"): ], next_page_token="abc", ), - private_catalog.SearchCatalogsResponse(catalogs=[], next_page_token="def",), private_catalog.SearchCatalogsResponse( - catalogs=[private_catalog.Catalog(),], next_page_token="ghi", + catalogs=[], + next_page_token="def", ), private_catalog.SearchCatalogsResponse( - catalogs=[private_catalog.Catalog(), private_catalog.Catalog(),], + catalogs=[ + private_catalog.Catalog(), + ], + next_page_token="ghi", + ), + private_catalog.SearchCatalogsResponse( + catalogs=[ + private_catalog.Catalog(), + private_catalog.Catalog(), + ], ), RuntimeError, ) @@ -810,7 +847,8 @@ def test_search_catalogs_pager(transport_name: str = "grpc"): def test_search_catalogs_pages(transport_name: str = "grpc"): client = PrivateCatalogClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -825,12 +863,21 @@ def test_search_catalogs_pages(transport_name: str = "grpc"): ], next_page_token="abc", ), - private_catalog.SearchCatalogsResponse(catalogs=[], next_page_token="def",), private_catalog.SearchCatalogsResponse( - catalogs=[private_catalog.Catalog(),], next_page_token="ghi", + catalogs=[], + next_page_token="def", + ), + private_catalog.SearchCatalogsResponse( + catalogs=[ + private_catalog.Catalog(), + ], + next_page_token="ghi", ), private_catalog.SearchCatalogsResponse( - catalogs=[private_catalog.Catalog(), private_catalog.Catalog(),], + catalogs=[ + private_catalog.Catalog(), + private_catalog.Catalog(), + ], ), RuntimeError, ) @@ -841,7 +888,9 @@ def test_search_catalogs_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_search_catalogs_async_pager(): - client = PrivateCatalogAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = PrivateCatalogAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -857,16 +906,27 @@ async def test_search_catalogs_async_pager(): ], next_page_token="abc", ), - private_catalog.SearchCatalogsResponse(catalogs=[], next_page_token="def",), private_catalog.SearchCatalogsResponse( - catalogs=[private_catalog.Catalog(),], next_page_token="ghi", + catalogs=[], + next_page_token="def", ), private_catalog.SearchCatalogsResponse( - catalogs=[private_catalog.Catalog(), private_catalog.Catalog(),], + catalogs=[ + private_catalog.Catalog(), + ], + next_page_token="ghi", + ), + private_catalog.SearchCatalogsResponse( + catalogs=[ + private_catalog.Catalog(), + private_catalog.Catalog(), + ], ), RuntimeError, ) - async_pager = await client.search_catalogs(request={},) + async_pager = await client.search_catalogs( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] async for response in async_pager: @@ -878,7 +938,9 @@ async def test_search_catalogs_async_pager(): @pytest.mark.asyncio async def test_search_catalogs_async_pages(): - client = PrivateCatalogAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = PrivateCatalogAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -894,12 +956,21 @@ async def test_search_catalogs_async_pages(): ], next_page_token="abc", ), - private_catalog.SearchCatalogsResponse(catalogs=[], next_page_token="def",), private_catalog.SearchCatalogsResponse( - catalogs=[private_catalog.Catalog(),], next_page_token="ghi", + catalogs=[], + next_page_token="def", + ), + private_catalog.SearchCatalogsResponse( + catalogs=[ + private_catalog.Catalog(), + ], + next_page_token="ghi", ), private_catalog.SearchCatalogsResponse( - catalogs=[private_catalog.Catalog(), private_catalog.Catalog(),], + catalogs=[ + private_catalog.Catalog(), + private_catalog.Catalog(), + ], ), RuntimeError, ) @@ -910,10 +981,17 @@ async def test_search_catalogs_async_pages(): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [private_catalog.SearchProductsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + private_catalog.SearchProductsRequest, + dict, + ], +) def test_search_products(request_type, transport: str = "grpc"): client = PrivateCatalogClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -942,7 +1020,8 @@ def test_search_products_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = PrivateCatalogClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -958,7 +1037,8 @@ async def test_search_products_async( transport: str = "grpc_asyncio", request_type=private_catalog.SearchProductsRequest ): client = PrivateCatalogAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -991,7 +1071,9 @@ async def test_search_products_async_from_dict(): def test_search_products_field_headers(): - client = PrivateCatalogClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PrivateCatalogClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. @@ -1011,7 +1093,10 @@ def test_search_products_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "resource=resource/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1040,12 +1125,16 @@ async def test_search_products_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "resource=resource/value", + ) in kw["metadata"] def test_search_products_pager(transport_name: str = "grpc"): client = PrivateCatalogClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1060,12 +1149,21 @@ def test_search_products_pager(transport_name: str = "grpc"): ], next_page_token="abc", ), - private_catalog.SearchProductsResponse(products=[], next_page_token="def",), private_catalog.SearchProductsResponse( - products=[private_catalog.Product(),], next_page_token="ghi", + products=[], + next_page_token="def", ), private_catalog.SearchProductsResponse( - products=[private_catalog.Product(), private_catalog.Product(),], + products=[ + private_catalog.Product(), + ], + next_page_token="ghi", + ), + private_catalog.SearchProductsResponse( + products=[ + private_catalog.Product(), + private_catalog.Product(), + ], ), RuntimeError, ) @@ -1085,7 +1183,8 @@ def test_search_products_pager(transport_name: str = "grpc"): def test_search_products_pages(transport_name: str = "grpc"): client = PrivateCatalogClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1100,12 +1199,21 @@ def test_search_products_pages(transport_name: str = "grpc"): ], next_page_token="abc", ), - private_catalog.SearchProductsResponse(products=[], next_page_token="def",), private_catalog.SearchProductsResponse( - products=[private_catalog.Product(),], next_page_token="ghi", + products=[], + next_page_token="def", ), private_catalog.SearchProductsResponse( - products=[private_catalog.Product(), private_catalog.Product(),], + products=[ + private_catalog.Product(), + ], + next_page_token="ghi", + ), + private_catalog.SearchProductsResponse( + products=[ + private_catalog.Product(), + private_catalog.Product(), + ], ), RuntimeError, ) @@ -1116,7 +1224,9 @@ def test_search_products_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_search_products_async_pager(): - client = PrivateCatalogAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = PrivateCatalogAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1132,16 +1242,27 @@ async def test_search_products_async_pager(): ], next_page_token="abc", ), - private_catalog.SearchProductsResponse(products=[], next_page_token="def",), private_catalog.SearchProductsResponse( - products=[private_catalog.Product(),], next_page_token="ghi", + products=[], + next_page_token="def", ), private_catalog.SearchProductsResponse( - products=[private_catalog.Product(), private_catalog.Product(),], + products=[ + private_catalog.Product(), + ], + next_page_token="ghi", + ), + private_catalog.SearchProductsResponse( + products=[ + private_catalog.Product(), + private_catalog.Product(), + ], ), RuntimeError, ) - async_pager = await client.search_products(request={},) + async_pager = await client.search_products( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] async for response in async_pager: @@ -1153,7 +1274,9 @@ async def test_search_products_async_pager(): @pytest.mark.asyncio async def test_search_products_async_pages(): - client = PrivateCatalogAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = PrivateCatalogAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1169,12 +1292,21 @@ async def test_search_products_async_pages(): ], next_page_token="abc", ), - private_catalog.SearchProductsResponse(products=[], next_page_token="def",), private_catalog.SearchProductsResponse( - products=[private_catalog.Product(),], next_page_token="ghi", + products=[], + next_page_token="def", ), private_catalog.SearchProductsResponse( - products=[private_catalog.Product(), private_catalog.Product(),], + products=[ + private_catalog.Product(), + ], + next_page_token="ghi", + ), + private_catalog.SearchProductsResponse( + products=[ + private_catalog.Product(), + private_catalog.Product(), + ], ), RuntimeError, ) @@ -1185,10 +1317,17 @@ async def test_search_products_async_pages(): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [private_catalog.SearchVersionsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + private_catalog.SearchVersionsRequest, + dict, + ], +) def test_search_versions(request_type, transport: str = "grpc"): client = PrivateCatalogClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1217,7 +1356,8 @@ def test_search_versions_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = PrivateCatalogClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1233,7 +1373,8 @@ async def test_search_versions_async( transport: str = "grpc_asyncio", request_type=private_catalog.SearchVersionsRequest ): client = PrivateCatalogAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1266,7 +1407,9 @@ async def test_search_versions_async_from_dict(): def test_search_versions_field_headers(): - client = PrivateCatalogClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PrivateCatalogClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. @@ -1286,7 +1429,10 @@ def test_search_versions_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "resource=resource/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1315,12 +1461,16 @@ async def test_search_versions_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "resource=resource/value", + ) in kw["metadata"] def test_search_versions_pager(transport_name: str = "grpc"): client = PrivateCatalogClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1335,12 +1485,21 @@ def test_search_versions_pager(transport_name: str = "grpc"): ], next_page_token="abc", ), - private_catalog.SearchVersionsResponse(versions=[], next_page_token="def",), private_catalog.SearchVersionsResponse( - versions=[private_catalog.Version(),], next_page_token="ghi", + versions=[], + next_page_token="def", ), private_catalog.SearchVersionsResponse( - versions=[private_catalog.Version(), private_catalog.Version(),], + versions=[ + private_catalog.Version(), + ], + next_page_token="ghi", + ), + private_catalog.SearchVersionsResponse( + versions=[ + private_catalog.Version(), + private_catalog.Version(), + ], ), RuntimeError, ) @@ -1360,7 +1519,8 @@ def test_search_versions_pager(transport_name: str = "grpc"): def test_search_versions_pages(transport_name: str = "grpc"): client = PrivateCatalogClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1375,12 +1535,21 @@ def test_search_versions_pages(transport_name: str = "grpc"): ], next_page_token="abc", ), - private_catalog.SearchVersionsResponse(versions=[], next_page_token="def",), private_catalog.SearchVersionsResponse( - versions=[private_catalog.Version(),], next_page_token="ghi", + versions=[], + next_page_token="def", ), private_catalog.SearchVersionsResponse( - versions=[private_catalog.Version(), private_catalog.Version(),], + versions=[ + private_catalog.Version(), + ], + next_page_token="ghi", + ), + private_catalog.SearchVersionsResponse( + versions=[ + private_catalog.Version(), + private_catalog.Version(), + ], ), RuntimeError, ) @@ -1391,7 +1560,9 @@ def test_search_versions_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_search_versions_async_pager(): - client = PrivateCatalogAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = PrivateCatalogAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1407,16 +1578,27 @@ async def test_search_versions_async_pager(): ], next_page_token="abc", ), - private_catalog.SearchVersionsResponse(versions=[], next_page_token="def",), private_catalog.SearchVersionsResponse( - versions=[private_catalog.Version(),], next_page_token="ghi", + versions=[], + next_page_token="def", ), private_catalog.SearchVersionsResponse( - versions=[private_catalog.Version(), private_catalog.Version(),], + versions=[ + private_catalog.Version(), + ], + next_page_token="ghi", + ), + private_catalog.SearchVersionsResponse( + versions=[ + private_catalog.Version(), + private_catalog.Version(), + ], ), RuntimeError, ) - async_pager = await client.search_versions(request={},) + async_pager = await client.search_versions( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] async for response in async_pager: @@ -1428,7 +1610,9 @@ async def test_search_versions_async_pager(): @pytest.mark.asyncio async def test_search_versions_async_pages(): - client = PrivateCatalogAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = PrivateCatalogAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1444,12 +1628,21 @@ async def test_search_versions_async_pages(): ], next_page_token="abc", ), - private_catalog.SearchVersionsResponse(versions=[], next_page_token="def",), private_catalog.SearchVersionsResponse( - versions=[private_catalog.Version(),], next_page_token="ghi", + versions=[], + next_page_token="def", ), private_catalog.SearchVersionsResponse( - versions=[private_catalog.Version(), private_catalog.Version(),], + versions=[ + private_catalog.Version(), + ], + next_page_token="ghi", + ), + private_catalog.SearchVersionsResponse( + versions=[ + private_catalog.Version(), + private_catalog.Version(), + ], ), RuntimeError, ) @@ -1467,7 +1660,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = PrivateCatalogClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -1487,7 +1681,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = PrivateCatalogClient(client_options=options, transport=transport,) + client = PrivateCatalogClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -1503,7 +1700,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = PrivateCatalogClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -1548,8 +1746,13 @@ def test_transport_adc(transport_class): def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = PrivateCatalogClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.PrivateCatalogGrpcTransport,) + client = PrivateCatalogClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.PrivateCatalogGrpcTransport, + ) def test_private_catalog_base_transport_error(): @@ -1596,7 +1799,8 @@ def test_private_catalog_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.PrivateCatalogTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1754,7 +1958,8 @@ def test_private_catalog_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.PrivateCatalogGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1766,7 +1971,8 @@ def test_private_catalog_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.PrivateCatalogGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1875,7 +2081,9 @@ def test_private_catalog_transport_channel_mtls_with_adc(transport_class): def test_catalog_path(): catalog = "squid" - expected = "catalogs/{catalog}".format(catalog=catalog,) + expected = "catalogs/{catalog}".format( + catalog=catalog, + ) actual = PrivateCatalogClient.catalog_path(catalog) assert expected == actual @@ -1893,7 +2101,9 @@ def test_parse_catalog_path(): def test_product_path(): product = "whelk" - expected = "products/{product}".format(product=product,) + expected = "products/{product}".format( + product=product, + ) actual = PrivateCatalogClient.product_path(product) assert expected == actual @@ -1914,7 +2124,9 @@ def test_version_path(): product = "nudibranch" version = "cuttlefish" expected = "catalogs/{catalog}/products/{product}/versions/{version}".format( - catalog=catalog, product=product, version=version, + catalog=catalog, + product=product, + version=version, ) actual = PrivateCatalogClient.version_path(catalog, product, version) assert expected == actual @@ -1955,7 +2167,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "squid" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = PrivateCatalogClient.common_folder_path(folder) assert expected == actual @@ -1973,7 +2187,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "whelk" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = PrivateCatalogClient.common_organization_path(organization) assert expected == actual @@ -1991,7 +2207,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "oyster" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = PrivateCatalogClient.common_project_path(project) assert expected == actual @@ -2011,7 +2229,8 @@ def test_common_location_path(): project = "cuttlefish" location = "mussel" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = PrivateCatalogClient.common_location_path(project, location) assert expected == actual @@ -2036,7 +2255,8 @@ def test_client_with_default_client_info(): transports.PrivateCatalogTransport, "_prep_wrapped_messages" ) as prep: client = PrivateCatalogClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2045,7 +2265,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = PrivateCatalogClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2053,7 +2274,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = PrivateCatalogAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close"