Browse Source

test: add 'missing' tests

Identified when checking coverage while only testing utils
main
Rob Hallam 1 month ago
parent
commit
3173babcff
1 changed files with 20 additions and 5 deletions
  1. +20
    -5
      test/test_utils.py

+ 20
- 5
test/test_utils.py View File

@@ -208,11 +208,18 @@ class TestInterval(unittest.TestCase):

def test_move_end(self):
"""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):
"""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.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

def test_init_unhappy(self):


Loading…
Cancel
Save