@@ -66,36 +66,37 @@ class TestClient(unittest.TestCase):
6666 AUDIO_SOURCE_URI = 'gs://sample-bucket/sample-recording.flac'
6767 AUDIO_CONTENT = '/9j/4QNURXhpZgAASUkq'
6868
69- def _getTargetClass (self ):
69+ @staticmethod
70+ def _get_target_class ():
7071 from google .cloud .speech .client import Client
7172
7273 return Client
7374
74- def _makeOne (self , * args , ** kw ):
75- return self ._getTargetClass ()(* args , ** kw )
75+ def _make_one (self , * args , ** kw ):
76+ return self ._get_target_class ()(* args , ** kw )
7677
7778 def test_ctor (self ):
7879 from google .cloud .speech .connection import Connection
7980
8081 creds = _Credentials ()
8182 http = object ()
82- client = self ._makeOne (credentials = creds , http = http )
83+ client = self ._make_one (credentials = creds , http = http )
8384 self .assertIsInstance (client .connection , Connection )
8485 self .assertTrue (client .connection .credentials is creds )
8586 self .assertTrue (client .connection .http is http )
8687
8788 def test_ctor_use_gax_preset (self ):
8889 creds = _Credentials ()
8990 http = object ()
90- client = self ._makeOne (credentials = creds , http = http , use_gax = True )
91+ client = self ._make_one (credentials = creds , http = http , use_gax = True )
9192 self .assertTrue (client ._use_gax )
9293
9394 def test_create_sample_from_client (self ):
9495 from google .cloud import speech
9596 from google .cloud .speech .sample import Sample
9697
9798 credentials = _Credentials ()
98- client = self ._makeOne (credentials = credentials )
99+ client = self ._make_one (credentials = credentials )
99100
100101 sample = client .sample (source_uri = self .AUDIO_SOURCE_URI ,
101102 encoding = speech .Encoding .FLAC ,
@@ -144,7 +145,7 @@ def test_sync_recognize_content_with_optional_params_no_gax(self):
144145 }
145146 }
146147 credentials = _Credentials ()
147- client = self ._makeOne (credentials = credentials , use_gax = False )
148+ client = self ._make_one (credentials = credentials , use_gax = False )
148149 client .connection = _Connection (RETURNED )
149150
150151 encoding = speech .Encoding .FLAC
@@ -189,7 +190,7 @@ def test_sync_recognize_source_uri_without_optional_params_no_gax(self):
189190 }
190191 }
191192 credentials = _Credentials ()
192- client = self ._makeOne (credentials = credentials , use_gax = False )
193+ client = self ._make_one (credentials = credentials , use_gax = False )
193194 client .connection = _Connection (RETURNED )
194195
195196 encoding = speech .Encoding .FLAC
@@ -219,7 +220,7 @@ def test_sync_recognize_with_empty_results_no_gax(self):
219220 from unit_tests ._fixtures import SYNC_RECOGNIZE_EMPTY_RESPONSE
220221
221222 credentials = _Credentials ()
222- client = self ._makeOne (credentials = credentials , use_gax = False )
223+ client = self ._make_one (credentials = credentials , use_gax = False )
223224 client .connection = _Connection (SYNC_RECOGNIZE_EMPTY_RESPONSE )
224225
225226 sample = Sample (source_uri = self .AUDIO_SOURCE_URI ,
@@ -237,7 +238,7 @@ def test_sync_recognize_with_empty_results_gax(self):
237238 from google .cloud .speech .sample import Sample
238239
239240 credentials = _Credentials ()
240- client = self ._makeOne (credentials = credentials , use_gax = True )
241+ client = self ._make_one (credentials = credentials , use_gax = True )
241242 client .connection = _Connection ()
242243 client .connection .credentials = credentials
243244
@@ -280,7 +281,7 @@ def test_sync_recognize_with_gax(self):
280281 from google .cloud .speech import _gax
281282
282283 creds = _Credentials ()
283- client = self ._makeOne (credentials = creds , use_gax = True )
284+ client = self ._make_one (credentials = creds , use_gax = True )
284285 client .connection = _Connection ()
285286 client .connection .credentials = creds
286287 client ._speech_api = None
@@ -341,7 +342,7 @@ def test_async_supported_encodings(self):
341342 from google .cloud .speech .sample import Sample
342343
343344 credentials = _Credentials ()
344- client = self ._makeOne (credentials = credentials )
345+ client = self ._make_one (credentials = credentials )
345346 client .connection = _Connection ({})
346347
347348 sample = Sample (source_uri = self .AUDIO_SOURCE_URI ,
@@ -359,7 +360,7 @@ def test_async_recognize_no_gax(self):
359360 RETURNED = ASYNC_RECOGNIZE_RESPONSE
360361
361362 credentials = _Credentials ()
362- client = self ._makeOne (credentials = credentials , use_gax = False )
363+ client = self ._make_one (credentials = credentials , use_gax = False )
363364 client .connection = _Connection (RETURNED )
364365
365366 sample = Sample (source_uri = self .AUDIO_SOURCE_URI ,
@@ -381,8 +382,8 @@ def test_async_recognize_with_gax(self):
381382 from google .cloud .speech .operation import Operation
382383
383384 credentials = _Credentials ()
384- client = self ._makeOne (credentials = credentials ,
385- use_gax = True )
385+ client = self ._make_one (credentials = credentials ,
386+ use_gax = True )
386387 client .connection = _Connection ()
387388 client .connection .credentials = credentials
388389
@@ -423,7 +424,7 @@ def test_streaming_depends_on_gax(self):
423424 from google .cloud ._testing import _Monkey
424425
425426 credentials = _Credentials ()
426- client = self ._makeOne (credentials = credentials , use_gax = False )
427+ client = self ._make_one (credentials = credentials , use_gax = False )
427428 client .connection = _Connection ()
428429
429430 with self .assertRaises (EnvironmentError ):
@@ -439,7 +440,7 @@ def test_streaming_closed_stream(self):
439440
440441 stream = BytesIO (b'Some audio data...' )
441442 credentials = _Credentials ()
442- client = self ._makeOne (credentials = credentials )
443+ client = self ._make_one (credentials = credentials )
443444 client .connection = _Connection ()
444445 client .connection .credentials = credentials
445446
@@ -479,7 +480,7 @@ def test_stream_recognize_interim_results(self):
479480
480481 stream = BytesIO (b'Some audio data...' )
481482 credentials = _Credentials ()
482- client = self ._makeOne (credentials = credentials )
483+ client = self ._make_one (credentials = credentials )
483484 client .connection = _Connection ()
484485 client .connection .credentials = credentials
485486
@@ -541,7 +542,7 @@ def test_stream_recognize(self):
541542
542543 stream = BytesIO (b'Some audio data...' )
543544 credentials = _Credentials ()
544- client = self ._makeOne (credentials = credentials )
545+ client = self ._make_one (credentials = credentials )
545546 client .connection = _Connection ()
546547 client .connection .credentials = credentials
547548
@@ -597,7 +598,7 @@ def test_stream_recognize_no_results(self):
597598
598599 stream = BytesIO (b'Some audio data...' )
599600 credentials = _Credentials ()
600- client = self ._makeOne (credentials = credentials )
601+ client = self ._make_one (credentials = credentials )
601602 client .connection = _Connection ()
602603 client .connection .credentials = credentials
603604
@@ -633,7 +634,7 @@ def test_speech_api_with_gax(self):
633634 from google .cloud .speech import _gax
634635
635636 creds = _Credentials ()
636- client = self ._makeOne (credentials = creds , use_gax = True )
637+ client = self ._make_one (credentials = creds , use_gax = True )
637638 client .connection = _Connection ()
638639 client .connection .credentials = creds
639640
@@ -666,14 +667,14 @@ def test_speech_api_without_gax(self):
666667 from google .cloud .speech .client import _JSONSpeechAPI
667668
668669 creds = _Credentials ()
669- client = self ._makeOne (credentials = creds , use_gax = False )
670+ client = self ._make_one (credentials = creds , use_gax = False )
670671 self .assertIsNone (client ._speech_api )
671672 self .assertIsInstance (client .speech_api , _JSONSpeechAPI )
672673 self .assertIsInstance (client .speech_api .connection , Connection )
673674
674675 def test_speech_api_preset (self ):
675676 creds = _Credentials ()
676- client = self ._makeOne (credentials = creds )
677+ client = self ._make_one (credentials = creds )
677678 fake_api = object ()
678679 client ._speech_api = fake_api
679680
0 commit comments