Преглед изворни кода

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…
Откажи
Сачувај