doocus improvemnts
This commit is contained in:
@@ -51,6 +51,10 @@ class TestDefaults(unittest.TestCase):
|
||||
def test_to_dict_analysis_is_embed_images(self):
|
||||
self.assertEqual(cfg().to_dict()["analysis"]["method"], "embed-images")
|
||||
|
||||
def test_out_format_defaults_none_and_passes_through(self):
|
||||
self.assertIsNone(cfg().out_format)
|
||||
self.assertEqual(cfg(out_format="{name}.meetus").out_format, "{name}.meetus")
|
||||
|
||||
def test_to_dict_whisper_has_diarize_and_formats(self):
|
||||
d = cfg(diarize=True, transcript_formats="srt").to_dict()
|
||||
self.assertTrue(d["whisper"]["diarize"])
|
||||
|
||||
@@ -167,10 +167,22 @@ class TestTreeIndex(unittest.TestCase):
|
||||
self.assertEqual(modes["team a/clip.mp4"], "meeting")
|
||||
self.assertEqual(modes["team a/notes.md"], "link")
|
||||
self.assertEqual(modes["misc.bin"], "link")
|
||||
# Every node carries the Drive-url slot.
|
||||
# Every node carries the Drive-url slot and a created date.
|
||||
self.assertTrue(all("url" in f for f in index["files"]))
|
||||
self.assertTrue(all(f.get("created") for f in index["files"]))
|
||||
self.assertTrue((out / "index.json").exists())
|
||||
|
||||
def test_meeting_node_points_at_meetus_sidecar(self):
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
src = Path(tmp) / "drive"
|
||||
(src / "team a").mkdir(parents=True)
|
||||
(src / "team a" / "standup.mp4").write_bytes(b"\x00\x00")
|
||||
index = build_index(src, Path(tmp) / "out")
|
||||
node = next(f for f in index["files"] if f["path"] == "team a/standup.mp4")
|
||||
# Deterministic pointer that `make batch ... OUT_FORMAT="{name}.meetus"` fills.
|
||||
self.assertEqual(node["out"], "team a/standup.mp4.meetus")
|
||||
self.assertEqual(node["transcript"], "team a/standup.mp4.meetus/standup_enhanced.txt")
|
||||
|
||||
@unittest.skipUnless(has("docx"), "python-docx not installed")
|
||||
def test_build_index_extracts_sidecar(self):
|
||||
import docx
|
||||
|
||||
@@ -50,6 +50,15 @@ class TestMakefile(unittest.TestCase):
|
||||
self.assertEqual(r.returncode, 0, r.stderr)
|
||||
self.assertIn("--language es", r.stdout)
|
||||
|
||||
def test_out_format_forwarded(self):
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
ind = Path(tmp) / "in"
|
||||
ind.mkdir()
|
||||
(ind / "x.mp4").touch()
|
||||
r = make("batch", IN=str(ind), PYTHON="echo", OUT_FORMAT="{name}.meetus")
|
||||
self.assertEqual(r.returncode, 0, r.stderr)
|
||||
self.assertIn("--out-format {name}.meetus", r.stdout)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
43
tests/test_output_manager.py
Normal file
43
tests/test_output_manager.py
Normal file
@@ -0,0 +1,43 @@
|
||||
"""OutputManager run-folder naming: the default {run} counter and the new
|
||||
configurable folder_format (deterministic sidecars for the doocus meeting flow)."""
|
||||
import tempfile
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
from tests import REPO_ROOT # noqa: F401
|
||||
from meetus.output_manager import OutputManager, DEFAULT_FOLDER_FORMAT
|
||||
|
||||
|
||||
class TestFolderFormat(unittest.TestCase):
|
||||
def test_default_uses_date_run_stem(self):
|
||||
with tempfile.TemporaryDirectory() as d:
|
||||
om = OutputManager(Path("/x/meeting.mkv"), d)
|
||||
name = om.output_dir.name
|
||||
self.assertTrue(name.endswith("-meeting"))
|
||||
# YYYYMMDD-NNN-meeting → middle part is the zero-padded run number
|
||||
self.assertRegex(name, r"^\d{8}-\d{3}-meeting$")
|
||||
|
||||
def test_deterministic_sidecar_no_counter(self):
|
||||
with tempfile.TemporaryDirectory() as d:
|
||||
om = OutputManager(Path("/x/team a/standup.mp4"), d, folder_format="{name}.meetus")
|
||||
self.assertEqual(om.output_dir.name, "standup.mp4.meetus")
|
||||
|
||||
def test_sidecar_reused_by_name(self):
|
||||
with tempfile.TemporaryDirectory() as d:
|
||||
a = OutputManager(Path("/x/standup.mp4"), d, folder_format="{name}.meetus")
|
||||
b = OutputManager(Path("/x/standup.mp4"), d, folder_format="{name}.meetus")
|
||||
self.assertEqual(a.output_dir, b.output_dir) # caching by stable name
|
||||
|
||||
def test_stem_token(self):
|
||||
with tempfile.TemporaryDirectory() as d:
|
||||
om = OutputManager(Path("/x/standup.mp4"), d, folder_format="{stem}")
|
||||
self.assertEqual(om.output_dir.name, "standup")
|
||||
|
||||
def test_empty_format_falls_back_to_default(self):
|
||||
with tempfile.TemporaryDirectory() as d:
|
||||
om = OutputManager(Path("/x/m.mkv"), d, folder_format="")
|
||||
self.assertEqual(om.folder_format, DEFAULT_FOLDER_FORMAT)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user