FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add speech async JSON/REST system tests. by daspecster · Pull Request #2648 · googleapis/google-cloud-python · GitHub

Add speech async JSON/REST system tests. - #2648

Merged
daspecster merged 1 commit into
googleapis:masterfrom
daspecster:add-speech-async-rest-system-tests
Oct 31, 2016
Merged

Add speech async JSON/REST system tests.#2648
daspecster merged 1 commit into
googleapis:masterfrom
daspecster:add-speech-async-rest-system-tests

Conversation

Copy link
Copy Markdown
Contributor

This adds JSON/REST system tests for speech's async_recognize() method.

daspecster added testing api: speech Issues related to the Speech-to-Text API. labels Oct 31, 2016
googlebot added the cla: yes This human has signed the Contributor License Agreement. label Oct 31, 2016
daspecster mentioned this pull request Oct 31, 2016
14 tasks
Comment thread system_tests/speech.py Outdated

def _make_async_request(self, content=None, source_uri=None,
max_alternatives=None):
client = speech.Client(use_gax=False)

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

Comment thread system_tests/speech.py Outdated
profanity_filter=True,
speech_context=['Google', 'cloud'])

return result

This comment was marked as spam.

Comment thread system_tests/speech.py Outdated
import time
with open(AUDIO_FILE, 'rb') as file_obj:
operation = self._make_async_request(content=file_obj.read(),
max_alternatives=2)

This comment was marked as spam.

Comment thread system_tests/speech.py Outdated
self._check_best_results(result)

def test_async_recognize_local_file(self):
import time

This comment was marked as spam.

Comment thread system_tests/speech.py Outdated
while retry_count > 0 and not operation.complete:
retry_count -= 1
time.sleep(10)
operation.poll()

This comment was marked as spam.

This comment was marked as spam.

Comment thread system_tests/speech.py Outdated
source_uri = 'gs://%s/%s' % (bucket_name, blob_name)
operation = self._make_async_request(source_uri=source_uri,
max_alternatives=2)
retry_count = 100

This comment was marked as spam.

This comment was marked as spam.

Comment thread system_tests/speech.py Outdated
retry_count = 100
while retry_count > 0 and not operation.complete:
retry_count -= 1
time.sleep(10)

This comment was marked as spam.

This comment was marked as spam.

Comment thread system_tests/speech.py Outdated
results = operation.results
self.assertIsInstance(results[0], Transcript)
self.assertEqual(results[0].transcript, 'hello ' + self.ASSERT_TEXT)
self.assertGreater(results[0].confidence, 0.90)

This comment was marked as spam.

Comment thread system_tests/speech.py Outdated
"""

def _operation_complete(result):
return result

This comment was marked as spam.

This comment was marked as spam.

Comment thread system_tests/speech.py
def test_async_recognize_local_file(self):
import time
if Config.USE_GAX:
self.skipTest('async_recognize gRPC not yet implemented.')

This comment was marked as spam.

This comment was marked as spam.

dhermes commented Oct 31, 2016

Copy link
Copy Markdown
Contributor

LGTM (assuming you are tracking those skipTest usages)

Comment thread system_tests/speech.py Outdated
:rtype: bool
:returns: Boolean indicating if the operation is complete.
"""

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

dhermes left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM provided you are tracking skipTest

Copy link
Copy Markdown
Contributor Author

Ok I'm squashing now. Thanks!

daspecster force-pushed the add-speech-async-rest-system-tests branch from b79b1ee to 80e4143 Compare October 31, 2016 17:05
daspecster merged commit 56fb77c into googleapis:master Oct 31, 2016
daspecster deleted the add-speech-async-rest-system-tests branch October 31, 2016 17:15
richkadel pushed a commit to richkadel/google-cloud-python that referenced this pull request May 6, 2017
…est-system-tests

Add speech async JSON/REST system tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: speech Issues related to the Speech-to-Text API. cla: yes This human has signed the Contributor License Agreement. testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL