From 5ca6f9e9d0226aa92b54ab00449f3e3424ff30c5 Mon Sep 17 00:00:00 2001 From: Rob Hallam <0504004h@student.gla.ac.uk> Date: Mon, 16 Sep 2024 02:11:02 +0100 Subject: [PATCH] test: [WordFE] cover non-batched --- test/test_feature_extractors.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/test/test_feature_extractors.py b/test/test_feature_extractors.py index 3fba4aa..0a2fb99 100644 --- a/test/test_feature_extractors.py +++ b/test/test_feature_extractors.py @@ -416,10 +416,17 @@ class TestWordFeatureExtractor(unittest.TestCase): test_extractor._batched_model = MagicMock() # set up and run the extractor 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): """Mock out the actual call to transcribe but match no words in the sentence"""