Skip to content

Commit

Permalink
Fix build failing with float precision mismatch (#3002)
Browse files Browse the repository at this point in the history
  • Loading branch information
daspecster authored and lukesneeringer committed Feb 14, 2017
1 parent ac612e6 commit e4661b0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
24 changes: 12 additions & 12 deletions speech/unit_tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,10 +297,10 @@ def test_sync_recognize_with_gax(self):

alternatives = [{
'transcript': 'testing 1 2 3',
'confidence': 0.9224355,
'confidence': 0.740234375,
}, {
'transcript': 'testing 4 5 6',
'confidence': 0.0123456,
'confidence': 0.6396484375,
}]
result = _make_result(alternatives)

Expand Down Expand Up @@ -500,19 +500,19 @@ def test_stream_recognize_interim_results(self):

alternatives = [{
'transcript': 'testing streaming 1 2 3',
'confidence': 0.9224355,
'confidence': 0.5888671875,
}, {
'transcript': 'testing streaming 4 5 6',
'confidence': 0.0123456,
'confidence': 0.28125,
}]
first_response = _make_streaming_response(
_make_streaming_result([], is_final=False, stability=0.122435))
_make_streaming_result([], is_final=False, stability=0.314453125))
second_response = _make_streaming_response(
_make_streaming_result(alternatives, is_final=False,
stability=0.1432343))
stability=0.28125))
last_response = _make_streaming_response(
_make_streaming_result(alternatives, is_final=True,
stability=0.9834534))
stability=0.4375))
responses = [first_response, second_response, last_response]

channel_args = []
Expand Down Expand Up @@ -542,8 +542,8 @@ def speech_api(channel=None):
self.assertIsInstance(results[0], StreamingSpeechResult)
self.assertEqual(results[0].alternatives, [])
self.assertFalse(results[0].is_final)
self.assertEqual(results[0].stability, 0.122435)
self.assertEqual(results[1].stability, 0.1432343)
self.assertEqual(results[0].stability, 0.314453125)
self.assertEqual(results[1].stability, 0.28125)
self.assertFalse(results[1].is_final)
self.assertEqual(results[1].transcript,
results[1].alternatives[0].transcript,
Expand All @@ -556,7 +556,7 @@ def speech_api(channel=None):
self.assertEqual(results[1].alternatives[1].confidence,
alternatives[1]['confidence'])
self.assertTrue(results[2].is_final)
self.assertEqual(results[2].stability, 0.9834534)
self.assertEqual(results[2].stability, 0.4375)
self.assertEqual(results[2].transcript,
results[2].alternatives[0].transcript,
alternatives[0]['transcript'])
Expand All @@ -580,10 +580,10 @@ def test_stream_recognize(self):

alternatives = [{
'transcript': 'testing streaming 1 2 3',
'confidence': 0.9224355,
'confidence': 0.4375,
}, {
'transcript': 'testing streaming 4 5 6',
'confidence': 0.0123456,
'confidence': 0.84375,
}]

first_response = _make_streaming_response(
Expand Down
6 changes: 3 additions & 3 deletions vision/unit_tests/test_annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def _make_pb_entity():
description = 'testing 1 2 3'
locale = 'US'
mid = 'm/w/45342234'
score = 0.235434231
score = 0.390625

entity_annotation = image_annotator_pb2.EntityAnnotation(
mid=mid,
Expand Down Expand Up @@ -108,7 +108,7 @@ def test_it(self):
description = 'testing 1 2 3'
locale = 'US'
mid = 'm/w/45342234'
score = 0.235434231
score = 0.390625
entity_annotation = _make_pb_entity()
entities = self._call_fut([entity_annotation])
self.assertEqual(len(entities), 1)
Expand Down Expand Up @@ -183,7 +183,7 @@ def test_it(self):
description = 'testing 1 2 3'
locale = 'US'
mid = 'm/w/45342234'
score = 0.235434231
score = 0.390625
entity_annotation = _make_pb_entity()

image_response = image_annotator_pb2.AnnotateImageResponse(
Expand Down
2 changes: 1 addition & 1 deletion vision/unit_tests/test_entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def test_logo_pb_annotation(self):
description = 'testing 1 2 3'
locale = 'US'
mid = 'm/w/45342234'
score = 0.235434231
score = 0.875
entity_annotation = image_annotator_pb2.EntityAnnotation()
entity_annotation.mid = mid
entity_annotation.locale = locale
Expand Down

0 comments on commit e4661b0

Please sign in to comment.