Просмотр исходного кода

test: update mocket get_loudnesses & test _keep_num

main
Rob Hallam 2 месяцев назад
Родитель
Сommit
c53704cf7c
1 измененных файлов: 20 добавлений и 2 удалений
  1. +20
    -2
      test/test_feature_extractors.py

+ 20
- 2
test/test_feature_extractors.py Просмотреть файл

@@ -220,15 +220,33 @@ class TestLoudAudioFeatureExtractor(unittest.TestCase):
self.assertEqual(len(test_extractor.features), 5)

def test_extract_mocked_get_loudnesses(self):
"""Test extract with mocked loudness detection"""
"""Test extract with mocked loudness detection - 100 loudnesses generated"""
video_source = TestSourceMedia().one_colour_silent_audio()
test_extractor = extractors.LoudAudioFeatureExtractor(input_files=video_source)
test_extractor = extractors.LoudAudioFeatureExtractor(input_files=video_source, num_features=100)
test_extractor._get_loudnesses = self._mock_get_loudnessess
test_extractor.setup()
test_extractor.run()
test_extractor.teardown()
self.assertEqual(len(test_extractor.features), 100)

def test_keep_num(self):
"""Test keep_num correctly keeps 5 / 10"""
video_source = TestSourceMedia().one_colour_silent_audio()
with self.subTest("keep 5 (default)"):
test_extractor = extractors.LoudAudioFeatureExtractor(input_files=video_source)
test_extractor._get_loudnesses = self._mock_get_loudnessess
test_extractor.setup()
test_extractor.run()
test_extractor.teardown()
self.assertEqual(len(test_extractor.features), 5)
with self.subTest("keep 10"):
test_extractor = extractors.LoudAudioFeatureExtractor(input_files=video_source, num_features=10)
test_extractor._get_loudnesses = self._mock_get_loudnessess
test_extractor.setup()
test_extractor.run()
test_extractor.teardown()
self.assertEqual(len(test_extractor.features), 10)

# TODO: add sample video with loud audio to test _loudnessdetect()

class TestVideoActivityFeatureExtractor(unittest.TestCase):


Загрузка…
Отмена
Сохранить