mirror of
https://github.com/shirayu/whispering.git
synced 2024-11-25 18:31:00 +00:00
28 lines
739 B
Python
28 lines
739 B
Python
#!/usr/bin/env python3
|
|
|
|
|
|
import sys
|
|
from unittest.mock import patch
|
|
|
|
from whispering.cli import get_opts, is_valid_arg
|
|
|
|
|
|
def test_options():
|
|
|
|
invalid_args = [
|
|
"--mode server --mic 0",
|
|
"--mode server --mic 1",
|
|
"--mode server --beam_size 3",
|
|
"--mode server --temperature 0",
|
|
"--mode server --allow-padding",
|
|
"--mode server --no-vad",
|
|
"--mode server --num_block 3",
|
|
"--mode mic --host 0.0.0.0",
|
|
"--mode mic --port 8000",
|
|
]
|
|
|
|
for invalid_arg in invalid_args:
|
|
with patch.object(sys, "argv", [""] + invalid_arg.split()):
|
|
opts = get_opts()
|
|
ok = is_valid_arg(opts)
|
|
assert ok is False, f"{invalid_arg} should be invalid"
|