瀏覽代碼

test: add TestSourceMedia & RFE.test_no_input

TestSourceMedia is a mockinobject so

TODO: rename
main
Rob Hallam 3 月之前
父節點
當前提交
28e33ed47a
共有 1 個文件被更改,包括 12 次插入0 次删除
  1. +12
    -0
      test/test_feature_extractors.py

+ 12
- 0
test/test_feature_extractors.py 查看文件

@@ -13,6 +13,12 @@ class TestSource():
SAMPLE_VIDEO = f"{TEST_DIR}/sample_videos/test_video_red_silentaudio.mp4" # silent video definitely has no laughter
return Source(source=SAMPLE_VIDEO, path=SAMPLE_VIDEO, provider="test")

class TestSourceMedia():
"""Provide utils.SourceMedia for testing"""
def one_colour_silent_audio(self):
"""Provide a source with a silent mono-colour video"""
return SourceMedia(sources=[TestSource().one_colour_silent_audio()])

class TestLaughterFeatureExtractor(unittest.TestCase):
"""Test LaughterFeatureExtractor"""
def test_init(self):
@@ -39,6 +45,12 @@ class TestRandomFeatureExtractor(unittest.TestCase):
test_extractor.setup()
# NB test WITH sources implicitly tested in test_extract

def test_extract_noinput(self):
"""Test extract with no input files"""
test_extractor = extractors.RandomFeatureExtractor()
with self.assertRaises(ValueError):
test_extractor.run()

def test_extract(self):
"""Test extract with input files"""
video_source = TestSourceMedia().one_colour_silent_audio()


Loading…
取消
儲存