import tempfile import unittest from pathlib import Path from video_ai_analysis_poc.discovery import discover_videos class DiscoveryTests(unittest.TestCase): def test_discovers_supported_extensions_without_recursion(self): with tempfile.TemporaryDirectory() as tmp: root = Path(tmp) nested = root / "nested" nested.mkdir() supported = root / "a.MP4" unsupported = root / "notes.txt" nested_video = nested / "b.mov" supported.write_text("not a real video", encoding="utf-8") unsupported.write_text("ignore me", encoding="utf-8") nested_video.write_text("not a real video", encoding="utf-8") videos = discover_videos(root, [".mp4", ".mov"], recursive=False) self.assertEqual(videos, [supported]) def test_discovers_supported_extensions_recursively_sorted(self): with tempfile.TemporaryDirectory() as tmp: root = Path(tmp) nested = root / "nested" nested.mkdir() first = root / "a.mp4" second = nested / "b.mov" first.write_text("x", encoding="utf-8") second.write_text("x", encoding="utf-8") videos = discover_videos(root, [".mp4", ".mov"], recursive=True) self.assertEqual(videos, [first, second]) if __name__ == "__main__": unittest.main()