Bläddra i källkod

test: add TestSourceMedia & RFE.test_no_input

TestSourceMedia is a mockinobject so

TODO: rename
main
Rob Hallam 2 månader sedan
förälder
incheckning
28e33ed47a
1 ändrade filer med 12 tillägg och 0 borttagningar
  1. +12
    -0
      test/test_feature_extractors.py

+ 12
- 0
test/test_feature_extractors.py Visa fil

@@ -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()


Laddar…
Avbryt
Spara