Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update _OperationsFuture usage.
  • Loading branch information
daspecster committed Jan 27, 2017
commit 25205d2d32a4499503535bbeec0800cb7fae6872
2 changes: 1 addition & 1 deletion speech/google/cloud/speech/_gax.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def async_recognize(self, sample, language_code=None,
api = self._gapic_api
operation_future = api.async_recognize(config=config, audio=audio)

return Operation.from_pb(operation_future._operation, self)
return Operation.from_pb(operation_future.last_operation_data(), self)

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.


def streaming_recognize(self, sample, language_code=None,
max_alternatives=None, profanity_filter=None,
Expand Down
7 changes: 5 additions & 2 deletions speech/unit_tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -725,13 +725,16 @@ def __init__(self, response=None, channel=None):
self._channel = channel

def async_recognize(self, config, audio):
from google.gapic.longrunning.operations_client import OperationsClient
from google.gax import _OperationFuture
from google.longrunning.operations_pb2 import Operation
from google.cloud.proto.speech.v1beta1.cloud_speech_pb2 import (
AsyncRecognizeResponse)

self.config = config
self.audio = audio
operation_future = mock.Mock(spec=_OperationFuture)
operation_future._operation = Operation()
operation_future = _OperationFuture(Operation(), OperationsClient(),
AsyncRecognizeResponse, {})
return operation_future

def sync_recognize(self, config, audio):
Expand Down