Refine seller store implementation

This commit is contained in:
R524809
2026-08-31 14:37:28 +08:00
parent 957289f717
commit 2a667b4f3b
27 changed files with 1650 additions and 624 deletions
+26
View File
@@ -0,0 +1,26 @@
"""轮播视频的无 FFmpeg 依赖单测:时长策略是 API/前端说明的共同契约。"""
from __future__ import annotations
import sys
import unittest
from pathlib import Path
SERVER_DIR = Path(__file__).resolve().parents[1]
if str(SERVER_DIR) not in sys.path:
sys.path.insert(0, str(SERVER_DIR))
from services.video_renderer import VideoRenderError, slide_seconds_for
class SlideDurationTests(unittest.TestCase):
def test_duration_strategy_for_two_to_five_images(self) -> None:
self.assertEqual([slide_seconds_for(count) for count in range(2, 6)], [4.5, 3.5, 3.0, 2.8])
def test_rejects_unsupported_count(self) -> None:
for count in (0, 1, 6):
with self.subTest(count=count), self.assertRaises(VideoRenderError):
slide_seconds_for(count)
if __name__ == "__main__":
unittest.main()