def test_folder_structure(self, tmp_path: PosixPath) -> None: subtitles: Set[PosixPath] = _get_subtitles_from_path( CreateFileTree.setup_two_fold_depth(tmp_path)) assert len(subtitles) == 2 assert Path(next(iter(subtitles))).parent.name == "raw_videos" assert Path(next(iter(subtitles))).parent.parent.name == "trailers"
def test_simple_directory(self, tmp_path: PosixPath) -> None: subtitles: Set[PosixPath] = _get_subtitles_from_path( CreateFileTree.setup_basic(tmp_path) ) assert len(subtitles) == 1 assert next(iter(subtitles)).name == "test video file.srt"
def test_complicated_directory(self, tmp_path: PosixPath) -> None: subtitles: Set[PosixPath] = _get_subtitles_from_path( CreateFileTree.setup_complicated(tmp_path)) assert len(subtitles) == 2 assert {vid.name for vid in subtitles} == { "English subtitles.srt", "Spanish subtitles.srt", }
def test_ignores_subtitle_folder(self, tmp_path: PosixPath) -> None: subtitles_dir: PosixPath = tmp_path / "vtt_subtitles" subtitles_dir.mkdir(exist_ok=True) ignore: PosixPath = subtitles_dir / "org1.srt" include: PosixPath = tmp_path / "some subtitle.srt" ignore.touch() include.touch() subtitles: Set[PosixPath] = _get_subtitles_from_path( root=tmp_path, subtitles_folder=subtitles_dir) assert len(subtitles) == 1 assert ignore not in subtitles assert include in subtitles