瀏覽代碼

test: [WordFE] cover non-batched

main
Rob Hallam 11 月之前
父節點
當前提交
5ca6f9e9d0
共有 1 個文件被更改,包括 10 次插入3 次删除
  1. +10
    -3
      test/test_feature_extractors.py

+ 10
- 3
test/test_feature_extractors.py 查看文件

@@ -416,10 +416,17 @@ class TestWordFeatureExtractor(unittest.TestCase):
test_extractor._batched_model = MagicMock() test_extractor._batched_model = MagicMock()
# set up and run the extractor # set up and run the extractor
test_extractor.setup(words=self._MOCK_SENTENCE) test_extractor.setup(words=self._MOCK_SENTENCE)
test_extractor.run()
test_extractor.teardown()
with self.subTest("batched"):
test_extractor.run()
test_extractor.teardown()
self.assertEqual(len(test_extractor.features), 9)
test_extractor.features = [] # reset features


self.assertEqual(len(test_extractor.features), 9)
with self.subTest("non-batched"):
test_extractor.DEFAULT_PIPELINE_TYPE = "non-batched"
test_extractor.run()
test_extractor.teardown()
self.assertEqual(len(test_extractor.features), 9)


def test_extract_mocked_transcribe_no_matching_words(self): def test_extract_mocked_transcribe_no_matching_words(self):
"""Mock out the actual call to transcribe but match no words in the sentence""" """Mock out the actual call to transcribe but match no words in the sentence"""


Loading…
取消
儲存