Download tests/test_cli.py from k9cli/video-vec2wav2-tokenizer: direct link, hf CLI and curl.
- Browser
- Download file 1.4 kB
-
https://huggingface.co/datasets/k9cli/video-vec2wav2-tokenizer/resolve/main/tests/test_cli.py
- Command line
-
hf download hf://datasets/k9cli/video-vec2wav2-tokenizer/tests/test_cli.py
-
curl -L -o test_cli.py https://huggingface.co/datasets/k9cli/video-vec2wav2-tokenizer/resolve/main/tests/test_cli.py
1.4 kB
| """Tests for the CLI argument parser and speaker assignment.""" | |
| from __future__ import annotations | |
| import pytest | |
| from video_vec2wav2_tokenizer.cli.commands import build_parser | |
| from video_vec2wav2_tokenizer.pipeline import assign_speaker | |
| from video_vec2wav2_tokenizer.utils.config import Config | |
| def test_parser_process() -> None: | |
| parser = build_parser() | |
| args = parser.parse_args(["process", "./videos", "--extract-features"]) | |
| assert args.command == "process" | |
| assert args.input == "./videos" | |
| assert args.extract_features is True | |
| def test_parser_requires_command() -> None: | |
| parser = build_parser() | |
| with pytest.raises(SystemExit): | |
| parser.parse_args([]) | |
| def test_parser_subcommands(command: str) -> None: | |
| parser = build_parser() | |
| args = parser.parse_args([command, "./input"]) | |
| assert args.command == command | |
| def test_speaker_modes() -> None: | |
| fixed = Config(speaker_mode="fixed", default_speaker="speaker_001") | |
| assert assign_speaker(fixed, video_index=3, file_index=7) == "speaker_001" | |
| per_video = Config(speaker_mode="per_video") | |
| assert assign_speaker(per_video, video_index=3, file_index=7) == "speaker_003" | |
| per_file = Config(speaker_mode="per_file") | |
| assert assign_speaker(per_file, video_index=3, file_index=7) == "speaker_007" | |