|
@@ -208,11 +208,18 @@ class TestInterval(unittest.TestCase): |
|
|
|
|
|
|
|
|
def test_move_end(self): |
|
|
def test_move_end(self): |
|
|
"""Test the move_end method - changes end time to time specified, keeps start time constant""" |
|
|
"""Test the move_end method - changes end time to time specified, keeps start time constant""" |
|
|
interval = utils.Interval(start=self.start, end=self.end) |
|
|
|
|
|
interval.move_end(15) |
|
|
|
|
|
self.assertEqual(interval.start, 0) |
|
|
|
|
|
self.assertEqual(interval.end, 15) |
|
|
|
|
|
self.assertEqual(interval.duration, 15) |
|
|
|
|
|
|
|
|
with self.subTest("non-relative"): |
|
|
|
|
|
interval = utils.Interval(start=self.start, end=self.end) |
|
|
|
|
|
interval.move_end(15) |
|
|
|
|
|
self.assertEqual(interval.start, 0) |
|
|
|
|
|
self.assertEqual(interval.end, 15) |
|
|
|
|
|
self.assertEqual(interval.duration, 15) |
|
|
|
|
|
with self.subTest("relative"): |
|
|
|
|
|
interval = utils.Interval(start=self.start, end=self.end) |
|
|
|
|
|
interval.move_end(5, relative=True) |
|
|
|
|
|
self.assertEqual(interval.start, 0) |
|
|
|
|
|
self.assertEqual(interval.end, 15) |
|
|
|
|
|
self.assertEqual(interval.duration, 15) |
|
|
|
|
|
|
|
|
def test_update_duration(self): |
|
|
def test_update_duration(self): |
|
|
"""Test the update_duration method - changes duration to time specified, keeps start time constant""" |
|
|
"""Test the update_duration method - changes duration to time specified, keeps start time constant""" |
|
@@ -354,6 +361,14 @@ class TestFeature(unittest.TestCase): |
|
|
self.assertEqual(feature1, feature2) |
|
|
self.assertEqual(feature1, feature2) |
|
|
self.assertNotEqual(feature1, feature3) |
|
|
self.assertNotEqual(feature1, feature3) |
|
|
|
|
|
|
|
|
|
|
|
def test_feature_no_score(self): |
|
|
|
|
|
"""Test creating a Feature without a score""" |
|
|
|
|
|
source = MockSource("source") |
|
|
|
|
|
interval = MockInterval(0, 10) |
|
|
|
|
|
feature_extractor = "test" |
|
|
|
|
|
feature = utils.Feature(interval, source, feature_extractor) |
|
|
|
|
|
self.assertEqual(feature.score, 0.0) |
|
|
|
|
|
|
|
|
# unhappy path tests |
|
|
# unhappy path tests |
|
|
|
|
|
|
|
|
def test_init_unhappy(self): |
|
|
def test_init_unhappy(self): |
|
|