@@ -277,20 +277,20 @@ def test_document_processor_service_client_client_options(
277
277
# unsupported value.
278
278
with mock .patch .dict (os .environ , {"GOOGLE_API_USE_MTLS_ENDPOINT" : "Unsupported" }):
279
279
with pytest .raises (MutualTLSChannelError ):
280
- client = client_class ()
280
+ client = client_class (transport = transport_name )
281
281
282
282
# Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value.
283
283
with mock .patch .dict (
284
284
os .environ , {"GOOGLE_API_USE_CLIENT_CERTIFICATE" : "Unsupported" }
285
285
):
286
286
with pytest .raises (ValueError ):
287
- client = client_class ()
287
+ client = client_class (transport = transport_name )
288
288
289
289
# Check the case quota_project_id is provided
290
290
options = client_options .ClientOptions (quota_project_id = "octopus" )
291
291
with mock .patch .object (transport_class , "__init__" ) as patched :
292
292
patched .return_value = None
293
- client = client_class (transport = transport_name , client_options = options )
293
+ client = client_class (client_options = options , transport = transport_name )
294
294
patched .assert_called_once_with (
295
295
credentials = None ,
296
296
credentials_file = None ,
@@ -359,7 +359,7 @@ def test_document_processor_service_client_mtls_env_auto(
359
359
)
360
360
with mock .patch .object (transport_class , "__init__" ) as patched :
361
361
patched .return_value = None
362
- client = client_class (transport = transport_name , client_options = options )
362
+ client = client_class (client_options = options , transport = transport_name )
363
363
364
364
if use_client_cert_env == "false" :
365
365
expected_client_cert_source = None
@@ -458,7 +458,7 @@ def test_document_processor_service_client_client_options_scopes(
458
458
options = client_options .ClientOptions (scopes = ["1" , "2" ],)
459
459
with mock .patch .object (transport_class , "__init__" ) as patched :
460
460
patched .return_value = None
461
- client = client_class (transport = transport_name , client_options = options )
461
+ client = client_class (client_options = options , transport = transport_name )
462
462
patched .assert_called_once_with (
463
463
credentials = None ,
464
464
credentials_file = None ,
@@ -493,7 +493,7 @@ def test_document_processor_service_client_client_options_credentials_file(
493
493
options = client_options .ClientOptions (credentials_file = "credentials.json" )
494
494
with mock .patch .object (transport_class , "__init__" ) as patched :
495
495
patched .return_value = None
496
- client = client_class (transport = transport_name , client_options = options )
496
+ client = client_class (client_options = options , transport = transport_name )
497
497
patched .assert_called_once_with (
498
498
credentials = None ,
499
499
credentials_file = "credentials.json" ,
@@ -526,9 +526,10 @@ def test_document_processor_service_client_client_options_from_dict():
526
526
)
527
527
528
528
529
- def test_process_document (
530
- transport : str = "grpc" , request_type = document_processor_service .ProcessRequest
531
- ):
529
+ @pytest .mark .parametrize (
530
+ "request_type" , [document_processor_service .ProcessRequest , dict ,]
531
+ )
532
+ def test_process_document (request_type , transport : str = "grpc" ):
532
533
client = DocumentProcessorServiceClient (
533
534
credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
534
535
)
@@ -552,10 +553,6 @@ def test_process_document(
552
553
assert isinstance (response , document_processor_service .ProcessResponse )
553
554
554
555
555
- def test_process_document_from_dict ():
556
- test_process_document (request_type = dict )
557
-
558
-
559
556
def test_process_document_empty_call ():
560
557
# This test is a coverage failsafe to make sure that totally empty calls,
561
558
# i.e. request == None and no flattened fields passed, work.
@@ -737,9 +734,10 @@ async def test_process_document_flattened_error_async():
737
734
)
738
735
739
736
740
- def test_batch_process_documents (
741
- transport : str = "grpc" , request_type = document_processor_service .BatchProcessRequest
742
- ):
737
+ @pytest .mark .parametrize (
738
+ "request_type" , [document_processor_service .BatchProcessRequest , dict ,]
739
+ )
740
+ def test_batch_process_documents (request_type , transport : str = "grpc" ):
743
741
client = DocumentProcessorServiceClient (
744
742
credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
745
743
)
@@ -765,10 +763,6 @@ def test_batch_process_documents(
765
763
assert isinstance (response , future .Future )
766
764
767
765
768
- def test_batch_process_documents_from_dict ():
769
- test_batch_process_documents (request_type = dict )
770
-
771
-
772
766
def test_batch_process_documents_empty_call ():
773
767
# This test is a coverage failsafe to make sure that totally empty calls,
774
768
# i.e. request == None and no flattened fields passed, work.
@@ -962,10 +956,10 @@ async def test_batch_process_documents_flattened_error_async():
962
956
)
963
957
964
958
965
- def test_review_document (
966
- transport : str = "grpc" ,
967
- request_type = document_processor_service . ReviewDocumentRequest ,
968
- ):
959
+ @ pytest . mark . parametrize (
960
+ "request_type" , [ document_processor_service . ReviewDocumentRequest , dict ,]
961
+ )
962
+ def test_review_document ( request_type , transport : str = "grpc" ):
969
963
client = DocumentProcessorServiceClient (
970
964
credentials = ga_credentials .AnonymousCreden
10000
tials (), transport = transport ,
971
965
)
@@ -989,10 +983,6 @@ def test_review_document(
989
983
assert isinstance (response , future .Future )
990
984
991
985
992
- def test_review_document_from_dict ():
993
- test_review_document (request_type = dict )
994
-
995
-
996
986
def test_review_document_empty_call ():
997
987
# This test is a coverage failsafe to make sure that totally empty calls,
998
988
# i.e. request == None and no flattened fields passed, work.
@@ -1765,7 +1755,7 @@ def test_parse_common_location_path():
1765
1755
assert expected == actual
1766
1756
1767
1757
1768
- def test_client_withDEFAULT_CLIENT_INFO ():
1758
+ def test_client_with_default_client_info ():
1769
1759
client_info = gapic_v1 .client_info .ClientInfo ()
1770
1760
1771
1761
with mock .patch .object (
0 commit comments