@@ -89,15 +89,15 @@ def test_create_sample_from_client(self):
8989
9090 def test_sync_recognize_content_with_optional_params_no_gax (self ):
9191 from base64 import b64encode
92- from google .cloud ._helpers import _to_bytes
93- from google .cloud ._helpers import _bytes_to_unicode
9492
93+ from google .cloud ._helpers import _bytes_to_unicode
94+ from google .cloud ._helpers import _to_bytes
9595 from google .cloud ._testing import _Monkey
96- from google . cloud . speech import client as MUT
96+
9797 from google .cloud import speech
98+ from google .cloud .speech import client as MUT
9899 from google .cloud .speech .alternative import Alternative
99100 from google .cloud .speech .sample import Sample
100-
101101 from unit_tests ._fixtures import SYNC_RECOGNIZE_RESPONSE
102102
103103 _AUDIO_CONTENT = _to_bytes (self .AUDIO_CONTENT )
@@ -151,8 +151,9 @@ def test_sync_recognize_content_with_optional_params_no_gax(self):
151151
152152 def test_sync_recognize_source_uri_without_optional_params_no_gax (self ):
153153 from google .cloud ._testing import _Monkey
154- from google . cloud . speech import client as MUT
154+
155155 from google .cloud import speech
156+ from google .cloud .speech import client as MUT
156157 from google .cloud .speech .alternative import Alternative
157158 from google .cloud .speech .sample import Sample
158159 from unit_tests ._fixtures import SYNC_RECOGNIZE_RESPONSE
@@ -194,8 +195,9 @@ def test_sync_recognize_source_uri_without_optional_params_no_gax(self):
194195
195196 def test_sync_recognize_with_empty_results_no_gax (self ):
196197 from google .cloud ._testing import _Monkey
197- from google . cloud . speech import client as MUT
198+
198199 from google .cloud import speech
200+ from google .cloud .speech import client as MUT
199201 from google .cloud .speech .sample import Sample
200202 from unit_tests ._fixtures import SYNC_RECOGNIZE_EMPTY_RESPONSE
201203
@@ -212,8 +214,9 @@ def test_sync_recognize_with_empty_results_no_gax(self):
212214
213215 def test_sync_recognize_with_empty_results_gax (self ):
214216 from google .cloud ._testing import _Monkey
215- from google . cloud . speech import _gax as MUT
217+
216218 from google .cloud import speech
219+ from google .cloud .speech import _gax as MUT
217220 from google .cloud .speech .sample import Sample
218221
219222 credentials = _Credentials ()
@@ -231,9 +234,10 @@ def test_sync_recognize_with_empty_results_gax(self):
231234 client .sync_recognize (sample )
232235
233236 def test_sync_recognize_with_gax (self ):
237+ from google .cloud ._testing import _Monkey
238+
234239 from google .cloud import speech
235240 from google .cloud .speech import _gax as MUT
236- from google .cloud ._testing import _Monkey
237241
238242 creds = _Credentials ()
239243 client = self ._makeOne (credentials = creds , use_gax = True )
@@ -268,10 +272,10 @@ def test_async_supported_encodings(self):
268272 client .async_recognize (sample )
269273
270274 def test_async_recognize_no_gax (self ):
271- from unit_tests ._fixtures import ASYNC_RECOGNIZE_RESPONSE
272275 from google .cloud import speech
273276 from google .cloud .speech .operation import Operation
274277 from google .cloud .speech .sample import Sample
278+ from unit_tests ._fixtures import ASYNC_RECOGNIZE_RESPONSE
275279
276280 RETURNED = ASYNC_RECOGNIZE_RESPONSE
277281
@@ -291,9 +295,10 @@ def test_async_recognize_no_gax(self):
291295 self .assertIsNone (operation .metadata )
292296
293297 def test_async_recognize_with_gax (self ):
294- from google .cloud .speech import _gax as MUT
295298 from google .cloud ._testing import _Monkey
299+
296300 from google .cloud import speech
301+ from google .cloud .speech import _gax as MUT
297302 from google .cloud .speech .operation import Operation
298303
299304 credentials = _Credentials ()
@@ -312,8 +317,9 @@ def test_async_recognize_with_gax(self):
312317 self .assertIsNone (operation .response )
313318
314319 def test_speech_api_with_gax (self ):
315- from google .cloud .speech import _gax as MUT
316320 from google .cloud ._testing import _Monkey
321+
322+ from google .cloud .speech import _gax as MUT
317323 from google .cloud .speech .client import GAPICSpeechAPI
318324
319325 creds = _Credentials ()
@@ -342,24 +348,6 @@ def test_speech_api_preset(self):
342348 self .assertIs (client .speech_api , fake_api )
343349
344350
345- # class _MockGAPICAlternative(object):
346- # transcript = 'testing 1 2 3'
347- # confidence = 0.95234356
348- #
349- #
350- # class _MockGAPICSyncResult(object):
351- # alternatives = [_MockGAPICAlternative()]
352- #
353- #
354- # class _MockGAPICSpeechResponse(object):
355- # error = None
356- # endpointer_type = None
357- # name = None
358- # metadata = _MockGAPICMetadata()
359- # results = []
360- # result_index = 0
361-
362-
363351class _MockGAPICSpeechAPI (object ):
364352 _requests = None
365353 _response = None
0 commit comments