From e4661b0543410e2de221233a6029ca7bb3a218ca Mon Sep 17 00:00:00 2001 From: Thomas Schultz Date: Tue, 14 Feb 2017 10:59:12 -0500 Subject: [PATCH] Fix build failing with float precision mismatch (#3002) --- speech/unit_tests/test_client.py | 24 ++++++++++++------------ vision/unit_tests/test_annotations.py | 6 +++--- vision/unit_tests/test_entity.py | 2 +- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/speech/unit_tests/test_client.py b/speech/unit_tests/test_client.py index 2cf5b8e3282b..b8a87e8b0b55 100644 --- a/speech/unit_tests/test_client.py +++ b/speech/unit_tests/test_client.py @@ -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) @@ -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 = [] @@ -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, @@ -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']) @@ -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( diff --git a/vision/unit_tests/test_annotations.py b/vision/unit_tests/test_annotations.py index 2a5fb5b8ca92..41408a17b88c 100644 --- a/vision/unit_tests/test_annotations.py +++ b/vision/unit_tests/test_annotations.py @@ -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, @@ -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) @@ -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( diff --git a/vision/unit_tests/test_entity.py b/vision/unit_tests/test_entity.py index d644de925aab..00d7cd5b4d33 100644 --- a/vision/unit_tests/test_entity.py +++ b/vision/unit_tests/test_entity.py @@ -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