From 1ea881fc676ac98e4c3482ee33b3f8b1daf73b27 Mon Sep 17 00:00:00 2001 From: Rob Hallam <0504004h@student.gla.ac.uk> Date: Tue, 3 Sep 2024 11:49:13 +0100 Subject: [PATCH] test: add negative test for LaughFE Also rename positive test to indicate that --- test/test_feature_extractors_functional.py | 24 +++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/test/test_feature_extractors_functional.py b/test/test_feature_extractors_functional.py index e3736f0..f625d95 100644 --- a/test/test_feature_extractors_functional.py +++ b/test/test_feature_extractors_functional.py @@ -28,7 +28,7 @@ class FEFunctionalTest(unittest.TestCase): class TestLaughterFEFunctional(FEFunctionalTest): """TestLaughterFEFunctional -- functional tests for laughter detection feature extractor""" - def test_laughter_detection(self): + def test_laughter_detection_positive(self): """Test laughter detection feature extractor Uses: @@ -61,6 +61,28 @@ class TestLaughterFEFunctional(FEFunctionalTest): self.assertTrue(testfe.features[0].interval.start >= (START_TIME - testfe._PREPEND_TIME)) self.assertTrue(testfe.features[0].interval.end <= (END_TIME + testfe._APPEND_TIME)) + def test_laughter_detection_negative(self): + """Negative test for laughter detection feature extractor -- should not detect laughter in a silent video + + Uses: + - sample_videos/sample-manual-audio-blank-video-colours.mp4 + :: silent video (30s) + -- pass iff no laughter features + """ + SAMPLE_VIDEO = f"{self.SAMPLE_DIR}/sample-manual-audio-blank-video-colours.mp4" + + # create mock source with the video + source = mocks.MockSource(path=SAMPLE_VIDEO) + + # create the feature extractor + testfe = extractors.LaughterFeatureExtractor(input_files=[source]) + testfe.setup() + testfe.run() + testfe.teardown() + + # check if the feature was extracted: + self.assertFalse(testfe.features) + class TestVideoActivityFEFunctional(FEFunctionalTest): """TestVisualActivityFEFunctional -- functional tests for visual activity feature extractor