OLD | NEW |
1 # Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | 1 # Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. |
2 # | 2 # |
3 # Use of this source code is governed by a BSD-style license | 3 # Use of this source code is governed by a BSD-style license |
4 # that can be found in the LICENSE file in the root of the source | 4 # that can be found in the LICENSE file in the root of the source |
5 # tree. An additional intellectual property rights grant can be found | 5 # tree. An additional intellectual property rights grant can be found |
6 # in the file PATENTS. All contributing project authors may | 6 # in the file PATENTS. All contributing project authors may |
7 # be found in the AUTHORS file in the root of the source tree. | 7 # be found in the AUTHORS file in the root of the source tree. |
8 | 8 |
9 """Unit tests for the eval_scores module. | 9 """Unit tests for the eval_scores module. |
10 """ | 10 """ |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 self._fake_reference_signal_filepath, fake_reference_signal) | 44 self._fake_reference_signal_filepath, fake_reference_signal) |
45 self._fake_tested_signal_filepath = os.path.join( | 45 self._fake_tested_signal_filepath = os.path.join( |
46 self._output_path, 'fake_test.wav') | 46 self._output_path, 'fake_test.wav') |
47 signal_processing.SignalProcessingUtils.SaveWav( | 47 signal_processing.SignalProcessingUtils.SaveWav( |
48 self._fake_tested_signal_filepath, fake_tested_signal) | 48 self._fake_tested_signal_filepath, fake_tested_signal) |
49 | 49 |
50 def tearDown(self): | 50 def tearDown(self): |
51 """Recursively delete temporary folder.""" | 51 """Recursively delete temporary folder.""" |
52 shutil.rmtree(self._output_path) | 52 shutil.rmtree(self._output_path) |
53 | 53 |
54 def test_registered_classes(self): | 54 def testRegisteredClasses(self): |
55 # Preliminary check. | 55 # Preliminary check. |
56 self.assertTrue(os.path.exists(self._output_path)) | 56 self.assertTrue(os.path.exists(self._output_path)) |
57 | 57 |
58 # Check that there is at least one registered evaluation score worker. | 58 # Check that there is at least one registered evaluation score worker. |
59 registered_classes = eval_scores.EvaluationScore.REGISTERED_CLASSES | 59 registered_classes = eval_scores.EvaluationScore.REGISTERED_CLASSES |
60 self.assertIsInstance(registered_classes, dict) | 60 self.assertIsInstance(registered_classes, dict) |
61 self.assertGreater(len(registered_classes), 0) | 61 self.assertGreater(len(registered_classes), 0) |
62 | 62 |
63 # Instance evaluation score workers factory with fake dependencies. | 63 # Instance evaluation score workers factory with fake dependencies. |
64 eval_score_workers_factory = ( | 64 eval_score_workers_factory = ( |
(...skipping 10 matching lines...) Expand all Loading... |
75 # Set reference and test, then run. | 75 # Set reference and test, then run. |
76 eval_score_worker.SetReferenceSignalFilepath( | 76 eval_score_worker.SetReferenceSignalFilepath( |
77 self._fake_reference_signal_filepath) | 77 self._fake_reference_signal_filepath) |
78 eval_score_worker.SetTestedSignalFilepath( | 78 eval_score_worker.SetTestedSignalFilepath( |
79 self._fake_tested_signal_filepath) | 79 self._fake_tested_signal_filepath) |
80 eval_score_worker.Run(self._output_path) | 80 eval_score_worker.Run(self._output_path) |
81 | 81 |
82 # Check output. | 82 # Check output. |
83 score = data_access.ScoreFile.Load(eval_score_worker.output_filepath) | 83 score = data_access.ScoreFile.Load(eval_score_worker.output_filepath) |
84 self.assertTrue(isinstance(score, float)) | 84 self.assertTrue(isinstance(score, float)) |
OLD | NEW |