소스 검색

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 2 달 전
부모
커밋
e22ece92ba
1개의 변경된 파일28개의 추가작업 그리고 0개의 파일을 삭제
  1. +28
    -0
      test/test_adjusters.py

+ 28
- 0
test/test_adjusters.py 파일 보기

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

불러오는 중...
취소
저장