Parcourir la source

test: [TTA: adjust] test adjustments that result in no change

Cases:

 - no features
 - features under target duration
 - features equal to target duration
main
Rob Hallam il y a 2 mois
Parent
révision
e22ece92ba
1 fichiers modifiés avec 28 ajouts et 0 suppressions
  1. +28
    -0
      test/test_adjusters.py

+ 28
- 0
test/test_adjusters.py Voir le fichier

@@ -91,3 +91,31 @@ class TestTargetTimeAdjuster(unittest.TestCase):
# test
for time, margin, expected in test_cases:
self.assertEqual(tta._determine_margin(time, margin, strategy), expected)

def test_adjust_no_change(self):
"""Test adjusting of list of Features using TTA -- no change to list of Features

Cases:
- no Features --> []
- [Features] with total time < target time --> unchanged list
- [Features] with total time = target time --> unchanged list

TODO: test with Features > target
"""
with self.subTest("no Features"):
tta = adjusters.TargetTimeAdjuster()
self.assertEqual(tta.adjust(), [])

with self.subTest("Features < target time"):
features = []
for i in range(1, 5):
features.append(make_feature(duration=i*1.0))
tta = adjusters.TargetTimeAdjuster(features=features, target_time=20.0)
self.assertEqual(tta.adjust(), features)

with self.subTest("Features = target time"):
features = []
for i in range(1, 5):
features.append(make_feature(duration=i*1.0))
tta = adjusters.TargetTimeAdjuster(features=features, target_time=10.0)
self.assertEqual(tta.adjust(), features)

Chargement…
Annuler
Enregistrer