Skip to content

Commit 9ce2626

Browse files
committed
Define constants in right places.
1 parent 19e4c89 commit 9ce2626

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

system_tests/speech.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
from system_test_utils import unique_resource_id
2424
from retry import RetryErrors
2525

26+
AUDIO_FILE = os.path.join(os.path.dirname(__file__), 'data', 'hello.wav')
27+
2628

2729
class Config(object):
2830
"""Run-time configuration to be modified at set-up.
@@ -32,8 +34,6 @@ class Config(object):
3234
"""
3335
CLIENT = None
3436
TEST_BUCKET = None
35-
AUDIO_FILE = os.path.join(os.path.dirname(__file__), 'data', 'hello.wav')
36-
ASSERT_TEXT = 'thank you for using Google Cloud platform'
3737

3838

3939
def setUpModule():
@@ -56,6 +56,8 @@ def tearDownModule():
5656

5757

5858
class TestSpeechClient(unittest.TestCase):
59+
ASSERT_TEXT = 'thank you for using Google Cloud platform'
60+
5961
def setUp(self):
6062
self.to_delete_by_case = []
6163

@@ -81,7 +83,7 @@ def _check_best_results(self, results):
8183
top_result = results[0]
8284
self.assertIsInstance(top_result, Transcript)
8385
self.assertEqual(top_result.transcript,
84-
'hello ' + Config.ASSERT_TEXT)
86+
'hello ' + self.ASSERT_TEXT)
8587
self.assertGreater(top_result.confidence, 0.90)
8688

8789
def test_sync_recognize_local_file(self):
@@ -92,7 +94,7 @@ def test_sync_recognize_local_file(self):
9294
self.assertEqual(len(results), 2)
9395
self._check_best_results(results)
9496
self.assertIsInstance(second_alternative, Transcript)
95-
self.assertEqual(second_alternative.transcript, Config.ASSERT_TEXT)
97+
self.assertEqual(second_alternative.transcript, self.ASSERT_TEXT)
9698
self.assertEqual(second_alternative.confidence, 0.0)
9799

98100
def test_sync_recognize_gcs_file(self):

0 commit comments

Comments
 (0)