From 78d5ebb64fc43df9e857e1c37d650938d35a52df Mon Sep 17 00:00:00 2001 From: Thomas Schultz Date: Mon, 13 Feb 2017 14:07:05 -0500 Subject: [PATCH 1/4] Switch failing floats to 1/8. --- speech/unit_tests/test_client.py | 16 ++++++++-------- vision/unit_tests/test_annotations.py | 6 +++--- vision/unit_tests/test_entity.py | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/speech/unit_tests/test_client.py b/speech/unit_tests/test_client.py index 2cf5b8e3282b..4dc6c53e6d83 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.125, }, { 'transcript': 'testing 4 5 6', - 'confidence': 0.0123456, + 'confidence': 0.125, }] result = _make_result(alternatives) @@ -500,13 +500,13 @@ def test_stream_recognize_interim_results(self): alternatives = [{ 'transcript': 'testing streaming 1 2 3', - 'confidence': 0.9224355, + 'confidence': 0.125, }, { 'transcript': 'testing streaming 4 5 6', - 'confidence': 0.0123456, + 'confidence': 0.125, }] first_response = _make_streaming_response( - _make_streaming_result([], is_final=False, stability=0.122435)) + _make_streaming_result([], is_final=False, stability=0.125)) second_response = _make_streaming_response( _make_streaming_result(alternatives, is_final=False, stability=0.1432343)) @@ -542,7 +542,7 @@ 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[0].stability, 0.125) self.assertEqual(results[1].stability, 0.1432343) self.assertFalse(results[1].is_final) self.assertEqual(results[1].transcript, @@ -580,10 +580,10 @@ def test_stream_recognize(self): alternatives = [{ 'transcript': 'testing streaming 1 2 3', - 'confidence': 0.9224355, + 'confidence': 0.125, }, { 'transcript': 'testing streaming 4 5 6', - 'confidence': 0.0123456, + 'confidence': 0.125, }] first_response = _make_streaming_response( diff --git a/vision/unit_tests/test_annotations.py b/vision/unit_tests/test_annotations.py index 2a5fb5b8ca92..9a649685b5f4 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.125 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.125 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.125 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..33a3981471c5 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.125 entity_annotation = image_annotator_pb2.EntityAnnotation() entity_annotation.mid = mid entity_annotation.locale = locale From 6fe85374d321e1bfe5957c25850b687bdf999822 Mon Sep 17 00:00:00 2001 From: Thomas Schultz Date: Mon, 13 Feb 2017 14:14:22 -0500 Subject: [PATCH 2/4] Missed one. --- speech/unit_tests/test_client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/speech/unit_tests/test_client.py b/speech/unit_tests/test_client.py index 4dc6c53e6d83..1eda9ca58faa 100644 --- a/speech/unit_tests/test_client.py +++ b/speech/unit_tests/test_client.py @@ -509,7 +509,7 @@ def test_stream_recognize_interim_results(self): _make_streaming_result([], is_final=False, stability=0.125)) second_response = _make_streaming_response( _make_streaming_result(alternatives, is_final=False, - stability=0.1432343)) + stability=0.125)) last_response = _make_streaming_response( _make_streaming_result(alternatives, is_final=True, stability=0.9834534)) @@ -543,7 +543,7 @@ def speech_api(channel=None): self.assertEqual(results[0].alternatives, []) self.assertFalse(results[0].is_final) self.assertEqual(results[0].stability, 0.125) - self.assertEqual(results[1].stability, 0.1432343) + self.assertEqual(results[1].stability, 0.125) self.assertFalse(results[1].is_final) self.assertEqual(results[1].transcript, results[1].alternatives[0].transcript, From a589fb47dd5bc74e0090feb589f86462b8483369 Mon Sep 17 00:00:00 2001 From: Thomas Schultz Date: Mon, 13 Feb 2017 14:26:55 -0500 Subject: [PATCH 3/4] More interesting float values. --- speech/unit_tests/test_client.py | 20 ++++++++++---------- vision/unit_tests/test_annotations.py | 6 +++--- vision/unit_tests/test_entity.py | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/speech/unit_tests/test_client.py b/speech/unit_tests/test_client.py index 1eda9ca58faa..75dacb450183 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.125, + 'confidence': 0.740234375, }, { 'transcript': 'testing 4 5 6', - 'confidence': 0.125, + 'confidence': 0.6396484375, }] result = _make_result(alternatives) @@ -500,16 +500,16 @@ def test_stream_recognize_interim_results(self): alternatives = [{ 'transcript': 'testing streaming 1 2 3', - 'confidence': 0.125, + 'confidence': 0.5888671875, }, { 'transcript': 'testing streaming 4 5 6', - 'confidence': 0.125, + 'confidence': 0.28125, }] first_response = _make_streaming_response( - _make_streaming_result([], is_final=False, stability=0.125)) + _make_streaming_result([], is_final=False, stability=0.314453125)) second_response = _make_streaming_response( _make_streaming_result(alternatives, is_final=False, - stability=0.125)) + stability=0.28125)) last_response = _make_streaming_response( _make_streaming_result(alternatives, is_final=True, stability=0.9834534)) @@ -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.125) - self.assertEqual(results[1].stability, 0.125) + 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, @@ -580,10 +580,10 @@ def test_stream_recognize(self): alternatives = [{ 'transcript': 'testing streaming 1 2 3', - 'confidence': 0.125, + 'confidence': 0.4375, }, { 'transcript': 'testing streaming 4 5 6', - 'confidence': 0.125, + '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 9a649685b5f4..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.125 + 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.125 + 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.125 + 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 33a3981471c5..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.125 + score = 0.875 entity_annotation = image_annotator_pb2.EntityAnnotation() entity_annotation.mid = mid entity_annotation.locale = locale From 7c9cfd039f8ca41d32d4a2ec2c4df4576552e941 Mon Sep 17 00:00:00 2001 From: Thomas Schultz Date: Mon, 13 Feb 2017 14:54:55 -0500 Subject: [PATCH 4/4] Missed one. --- speech/unit_tests/test_client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/speech/unit_tests/test_client.py b/speech/unit_tests/test_client.py index 75dacb450183..b8a87e8b0b55 100644 --- a/speech/unit_tests/test_client.py +++ b/speech/unit_tests/test_client.py @@ -512,7 +512,7 @@ def test_stream_recognize_interim_results(self): 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 = [] @@ -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'])