@@ -231,20 +231,20 @@ def test_speech_client_client_options(client_class, transport_class, transport_n
231
231
# unsupported value.
232
232
with mock .patch .dict (os .environ , {"GOOGLE_API_USE_MTLS_ENDPOINT" : "Unsupported" }):
233
233
with pytest .raises (MutualTLSChannelError ):
234
- client = client_class ()
234
+ client = client_class (transport = transport_name )
235
235
236
236
# Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value.
237
237
with mock .patch .dict (
238
238
os .environ , {"GOOGLE_API_USE_CLIENT_CERTIFICATE" : "Unsupported" }
239
239
):
240
240
with pytest .raises (ValueError ):
241
- client = client_class ()
241
+ client = client_class (transport = transport_name )
242
242
243
243
# Check the case quota_project_id is provided
244
244
options = client_options .ClientOptions (quota_project_id = "octopus" )
245
245
with mock .patch .object (transport_class , "__init__" ) as patched :
246
246
patched .return_value = None
247
- client = client_class (transport = transport_name , client_options = options )
247
+ client = client_class (client_options = options , transport = transport_name )
248
248
patched .assert_called_once_with (
249
249
credentials = None ,
250
250
credentials_file = None ,
@@ -299,7 +299,7 @@ def test_speech_client_mtls_env_auto(
299
299
)
300
300
with mock .patch .object (transport_class , "__init__" ) as patched :
301
301
patched .return_value = None
302
- client = client_class (transport = transport_name , client_options = options )
302
+ client = client_class (client_options = options , transport = transport_name )
303
303
304
304
if use_client_cert_env == "false" :
305
305
expected_client_cert_source = None
@@ -390,7 +390,7 @@ def test_speech_client_client_options_scopes(
390
390
options = client_options .ClientOptions (scopes = ["1" , "2" ],)
391
391
with mock .patch .object (transport_class , "__init__" ) as patched :
392
392
patched .return_value = None
393
- client = client_class (transport = transport_name , client_options = options )
393
+ client = client_class (client_options = options , transport = transport_name )
394
394
patched .assert_called_once_with (
395
395
credentials = None ,
396
396
credentials_file = None ,
@@ -417,7 +417,7 @@ def test_speech_client_client_options_credentials_file(
417
417
options = client_options .ClientOptions (credentials_file = "credentials.json" )
418
418
with mock .patch .object (transport_class , "__init__" ) as patched :
419
419
patched .return_value = None
420
- client = client_class (transport = transport_name , client_options = options )
420
+ client = client_class (client_options = options , transport = transport_name )
421
421
patched .assert_called_once_with (
422
422
credentials = None ,
423
423
credentials_file = "credentials.json" ,
@@ -448,7 +448,8 @@ def test_speech_client_client_options_from_dict():
448
448
)
449
449
450
450
451
- def test_recognize (transport : str = "grpc" , request_type = cloud_speech .RecognizeRequest ):
451
+ @pytest .mark .parametrize ("request_type" , [cloud_speech .RecognizeRequest , dict ,])
452
+ def test_recognize (request_type , transport : str = "grpc" ):
452
453
client = SpeechClient (
453
454
credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
454
455
)
@@ -472,10 +473,6 @@ def test_recognize(transport: str = "grpc", request_type=cloud_speech.RecognizeR
472
473
assert isinstance (response , cloud_speech .RecognizeResponse )
473
474
474
475
475
- def test_recognize_from_dict ():
476
- test_recognize (request_type = dict )
477
-
478
-
479
476
def test_recognize_empty_call ():
480
477
# This test is a coverage failsafe to make sure that totally empty calls,
481
478
# i.e. request == None and no flattened fields passed, work.
@@ -621,9 +618,10 @@ async def test_recognize_flattened_error_async():
621
618
)
622
619
623
620
624
- def test_long_running_recognize (
625
- transport : str = "grpc" , request_type = cloud_speech .LongRunningRecognizeRequest
626
- ):
621
+ @pytest .mark .parametrize (
622
+ "request_type" , [cloud_speech .LongRunningRecognizeRequest , dict ,]
623
+ )
624
+ def test_long_running_recognize (request_type , transport : str = "grpc" ):
627
625
client = SpeechClient (
628
626
credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
629
627
)
@@ -649,10 +647,6 @@ def test_long_running_recognize(
649
647
assert isinstance (response , future .Future )
650
648
651
649
652
- def test_long_running_recognize_from_dict ():
653
- test_long_running_recognize (request_type = dict )
654
-
655
-
656
650
def test_long_running_recognize_empty_call ():
657
651
# This test is a coverage failsafe to make sure that totally empty calls,
658
652
# i.e. request == None and no flattened fields passed, work.
@@ -807,9 +801,10 @@ async def test_long_running_recognize_flattened_error_async():
807
801
)
808
802
809
803
810
- def test_streaming_recognize (
811
- transport : str = "grpc" , request_type = cloud_speech .StreamingRecognizeRequest
812
- ):
804
+ @pytest .mark .parametrize (
805
+ "request_type" , [cloud_speech .StreamingRecognizeRequest , dict ,]
806
+ )
807
+ def test_streaming_recognize (request_type , transport : str = "grpc" ):
813
808
client = SpeechClient (
814
809
credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
815
810
)
@@ -837,10 +832,6 @@ def test_streaming_recognize(
837
832
assert isinstance (message , cloud_speech .StreamingRecognizeResponse )
838
833
839
834
840
- def test_streaming_recognize_from_dict ():
841
- test_streaming_recognize (request_type = dict )
842
-
843
-
844
835
@pytest .mark .asyncio
845
836
async def test_streaming_recognize_async (
846
837
transport : str = "grpc_asyncio" , request_type = cloud_speech .StreamingRecognizeRequest
@@ -1434,7 +1425,7 @@ def test_parse_common_location_path():
1434
1425
assert expected == actual
1435
1426
1436
1427
1437
- def test_client_withDEFAULT_CLIENT_INFO ():
1428
+ def test_client_with_default_client_info ():
1438
1429
client_info = gapic_v1 .client_info .ClientInfo ()
1439
1430
1440
1431
with mock .patch .object (
0 commit comments