@@ -39,33 +39,33 @@ def test_ctor(self):
3939 self .assertTrue (client .connection .http is http )
4040
4141 def test_create_sample_from_client (self ):
42- from google .cloud . speech . encoding import Encoding
42+ from google .cloud import speech
4343 from google .cloud .speech .sample import Sample
4444
4545 credentials = _Credentials ()
4646 client = self ._makeOne (credentials = credentials )
4747
4848 sample = client .sample (source_uri = self .AUDIO_SOURCE_URI ,
49- encoding = Encoding .FLAC ,
49+ encoding = speech . Encoding .FLAC ,
5050 sample_rate = self .SAMPLE_RATE )
5151 self .assertIsInstance (sample , Sample )
5252 self .assertEqual (sample .source_uri , self .AUDIO_SOURCE_URI )
5353 self .assertEqual (sample .sample_rate , self .SAMPLE_RATE )
54- self .assertEqual (sample .encoding , Encoding .FLAC )
54+ self .assertEqual (sample .encoding , speech . Encoding .FLAC )
5555
5656 content_sample = client .sample (content = self .AUDIO_CONTENT ,
57- encoding = Encoding .FLAC ,
57+ encoding = speech . Encoding .FLAC ,
5858 sample_rate = self .SAMPLE_RATE )
5959 self .assertEqual (content_sample .content , self .AUDIO_CONTENT )
6060 self .assertEqual (content_sample .sample_rate , self .SAMPLE_RATE )
61- self .assertEqual (content_sample .encoding , Encoding .FLAC )
61+ self .assertEqual (content_sample .encoding , speech . Encoding .FLAC )
6262
6363 def test_sync_recognize_content_with_optional_parameters (self ):
6464 from base64 import b64encode
6565 from google .cloud ._helpers import _to_bytes
6666 from google .cloud ._helpers import _bytes_to_unicode
6767
68- from google .cloud . speech . encoding import Encoding
68+ from google .cloud import speech
6969 from google .cloud .speech .sample import Sample
7070 from unit_tests ._fixtures import SYNC_RECOGNIZE_RESPONSE
7171 _AUDIO_CONTENT = _to_bytes (self .AUDIO_CONTENT )
@@ -92,7 +92,7 @@ def test_sync_recognize_content_with_optional_parameters(self):
9292 client = self ._makeOne (credentials = credentials )
9393 client .connection = _Connection (RETURNED )
9494
95- encoding = Encoding .FLAC
95+ encoding = speech . Encoding .FLAC
9696
9797 sample = Sample (content = self .AUDIO_CONTENT , encoding = encoding ,
9898 sample_rate = self .SAMPLE_RATE )
@@ -113,7 +113,7 @@ def test_sync_recognize_content_with_optional_parameters(self):
113113 self .assertEqual (response , expected )
114114
115115 def test_sync_recognize_source_uri_without_optional_parameters (self ):
116- from google .cloud . speech . encoding import Encoding
116+ from google .cloud import speech
117117 from google .cloud .speech .sample import Sample
118118 from unit_tests ._fixtures import SYNC_RECOGNIZE_RESPONSE
119119
@@ -131,7 +131,7 @@ def test_sync_recognize_source_uri_without_optional_parameters(self):
131131 client = self ._makeOne (credentials = credentials )
132132 client .connection = _Connection (RETURNED )
133133
134- encoding = Encoding .FLAC
134+ encoding = speech . Encoding .FLAC
135135
136136 sample = Sample (source_uri = self .AUDIO_SOURCE_URI , encoding = encoding ,
137137 sample_rate = self .SAMPLE_RATE )
@@ -148,7 +148,7 @@ def test_sync_recognize_source_uri_without_optional_parameters(self):
148148 self .assertEqual (response , expected )
149149
150150 def test_sync_recognize_with_empty_results (self ):
151- from google .cloud . speech . encoding import Encoding
151+ from google .cloud import speech
152152 from google .cloud .speech .sample import Sample
153153 from unit_tests ._fixtures import SYNC_RECOGNIZE_EMPTY_RESPONSE
154154
@@ -158,27 +158,27 @@ def test_sync_recognize_with_empty_results(self):
158158
159159 with self .assertRaises (ValueError ):
160160 sample = Sample (source_uri = self .AUDIO_SOURCE_URI ,
161- encoding = Encoding .FLAC ,
161+ encoding = speech . Encoding .FLAC ,
162162 sample_rate = self .SAMPLE_RATE )
163163 client .sync_recognize (sample )
164164
165165 def test_async_supported_encodings (self ):
166- from google .cloud . speech . encoding import Encoding
166+ from google .cloud import speech
167167 from google .cloud .speech .sample import Sample
168168
169169 credentials = _Credentials ()
170170 client = self ._makeOne (credentials = credentials )
171171 client .connection = _Connection ({})
172172
173173 sample = Sample (source_uri = self .AUDIO_SOURCE_URI ,
174- encoding = Encoding .FLAC ,
174+ encoding = speech . Encoding .FLAC ,
175175 sample_rate = self .SAMPLE_RATE )
176176 with self .assertRaises (ValueError ):
177177 client .async_recognize (sample )
178178
179179 def test_async_recognize (self ):
180180 from unit_tests ._fixtures import ASYNC_RECOGNIZE_RESPONSE
181- from google .cloud . speech . encoding import Encoding
181+ from google .cloud import speech
182182 from google .cloud .speech .operation import Operation
183183 from google .cloud .speech .sample import Sample
184184 RETURNED = ASYNC_RECOGNIZE_RESPONSE
@@ -188,7 +188,7 @@ def test_async_recognize(self):
188188 client .connection = _Connection (RETURNED )
189189
190190 sample = Sample (source_uri = self .AUDIO_SOURCE_URI ,
191- encoding = Encoding .LINEAR16 ,
191+ encoding = speech . Encoding .LINEAR16 ,
192192 sample_rate = self .SAMPLE_RATE )
193193 operation = client .async_recognize (sample )
194194 self .assertIsInstance (operation , Operation )
0 commit comments