refactor (untested)
This commit is contained in:
77
tests/test_config.py
Normal file
77
tests/test_config.py
Normal file
@@ -0,0 +1,77 @@
|
||||
"""Deeper tests for WorkflowConfig — the --transcript-formats parsing and the
|
||||
post-cleanup shape (embed-images only; deprecated analysis attrs gone)."""
|
||||
import unittest
|
||||
|
||||
from meetus.workflow import WorkflowConfig
|
||||
|
||||
|
||||
def cfg(**kw):
|
||||
kw.setdefault("video", "sample.mp4")
|
||||
return WorkflowConfig(**kw)
|
||||
|
||||
|
||||
class TestTranscriptFormats(unittest.TestCase):
|
||||
def test_default_is_json_only(self):
|
||||
self.assertEqual(cfg().transcript_formats, ["json"])
|
||||
|
||||
def test_srt_implies_json(self):
|
||||
# User shouldn't have to list json; it's always the base.
|
||||
self.assertEqual(cfg(transcript_formats="srt").transcript_formats,
|
||||
["json", "srt"])
|
||||
|
||||
def test_multiple(self):
|
||||
self.assertEqual(cfg(transcript_formats="srt,txt").transcript_formats,
|
||||
["json", "srt", "txt"])
|
||||
|
||||
def test_all_expands(self):
|
||||
self.assertEqual(set(cfg(transcript_formats="all").transcript_formats),
|
||||
{"json", "srt", "vtt", "txt", "tsv"})
|
||||
|
||||
def test_dedup_and_json_kept(self):
|
||||
self.assertEqual(cfg(transcript_formats="json,srt,srt").transcript_formats,
|
||||
["json", "srt"])
|
||||
|
||||
def test_whitespace_and_case(self):
|
||||
self.assertEqual(cfg(transcript_formats=" SRT , Txt ").transcript_formats,
|
||||
["json", "srt", "txt"])
|
||||
|
||||
def test_invalid_raises(self):
|
||||
with self.assertRaises(ValueError):
|
||||
cfg(transcript_formats="srt,bogus")
|
||||
|
||||
|
||||
class TestDefaults(unittest.TestCase):
|
||||
def test_scalar_defaults(self):
|
||||
c = cfg()
|
||||
self.assertEqual(c.embed_quality, 80)
|
||||
self.assertEqual(c.format, "detailed")
|
||||
self.assertEqual(c.whisper_model, "medium")
|
||||
self.assertEqual(c.scene_threshold, 15.0)
|
||||
|
||||
def test_to_dict_analysis_is_embed_images(self):
|
||||
self.assertEqual(cfg().to_dict()["analysis"]["method"], "embed-images")
|
||||
|
||||
def test_to_dict_whisper_has_diarize_and_formats(self):
|
||||
d = cfg(diarize=True, transcript_formats="srt").to_dict()
|
||||
self.assertTrue(d["whisper"]["diarize"])
|
||||
self.assertEqual(d["whisper"]["transcript_formats"], ["json", "srt"])
|
||||
|
||||
|
||||
class TestDeprecatedRemoved(unittest.TestCase):
|
||||
"""The OCR/vision/hybrid surface was removed in the cleanup."""
|
||||
|
||||
def test_no_deprecated_attrs(self):
|
||||
c = cfg()
|
||||
for attr in ("use_vision", "use_hybrid", "hybrid_llm_cleanup",
|
||||
"hybrid_llm_model", "vision_model", "vision_context",
|
||||
"ocr_engine", "no_deduplicate"):
|
||||
self.assertFalse(hasattr(c, attr), f"{attr} should be removed")
|
||||
|
||||
def test_extra_kwargs_are_ignored(self):
|
||||
# Stray kwargs (e.g. an old flag) must not crash construction.
|
||||
c = cfg(use_vision=True, ocr_engine="tesseract")
|
||||
self.assertFalse(hasattr(c, "use_vision"))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user