tests.unit.gapic.documentai_v1beta2.test_document_understanding_service: test_batch_process_documents_flattened_async failed
Closed this issue · 3 comments
flaky-bot commented
This test failed!
To configure my behavior, see the Flaky Bot documentation.
If I'm commenting on this issue too often, add the flakybot: quiet
label and
I will stop commenting.
commit: d8aab64
buildURL: Build Status, Sponge
status: failed
Test output
@pytest.mark.asyncio async def test_batch_process_documents_flattened_async(): client = DocumentUnderstandingServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), )# Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( type(client.transport.batch_process_documents), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = operations_pb2.Operation(name="operations/op") call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( operations_pb2.Operation(name="operations/spam") ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method.
response = await client.batch_process_documents(
requests=[ document_understanding.ProcessDocumentRequest(parent="parent_value") ], )
tests/unit/gapic/documentai_v1beta2/test_document_understanding_service.py:911:
self = <google.cloud.documentai_v1beta2.services.document_understanding_service.async_client.DocumentUnderstandingServiceAsyncClient object at 0x7f7e7c1b9be0>
request =async def batch_process_documents( self, request: Union[ document_understanding.BatchProcessDocumentsRequest, dict ] = None, *, requests: Sequence[document_understanding.ProcessDocumentRequest] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""LRO endpoint to batch process many documents. The output is written to Cloud Storage as JSON in the [Document] format. .. code-block:: python from google.cloud import documentai_v1beta2 async def sample_batch_process_documents(): # Create a client client = documentai_v1beta2.DocumentUnderstandingServiceAsyncClient() # Initialize request argument(s) requests = documentai_v1beta2.ProcessDocumentRequest() requests.input_config.gcs_source.uri = "uri_value" requests.input_config.mime_type = "mime_type_value" request = documentai_v1beta2.BatchProcessDocumentsRequest( requests=requests, ) # Make the request operation = client.batch_process_documents(request=request) print("Waiting for operation to complete...") response = await operation.result() # Handle the response print(response) Args: request (Union[google.cloud.documentai_v1beta2.types.BatchProcessDocumentsRequest, dict]): The request object. Request to batch process documents as an asynchronous operation. The output is written to Cloud Storage as JSON in the [Document] format. requests (:class:`Sequence[google.cloud.documentai_v1beta2.types.ProcessDocumentRequest]`): Required. Individual requests for each document. This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. Returns: google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be :class:`google.cloud.documentai_v1beta2.types.BatchProcessDocumentsResponse` Response to an batch document processing request. This is returned in the LRO Operation after the operation is complete. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([requests]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) request = document_understanding.BatchProcessDocumentsRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if requests:
request.requests.extend(requests)
E TypeError: Expected a message object, but got parent: "parent_value"
E .google/cloud/documentai_v1beta2/services/document_understanding_service/async_client.py:299: TypeError