Spaces:
Running
Running
Download tests/test_ffprobe.py from basyx/MediaRouter: direct link, hf CLI and curl.
- Browser
- Download file 711 Bytes
-
https://huggingface.co/spaces/basyx/MediaRouter/resolve/main/tests/test_ffprobe.py
- Command line
-
hf download hf://spaces/basyx/MediaRouter/tests/test_ffprobe.py
-
curl -L -o test_ffprobe.py https://huggingface.co/spaces/basyx/MediaRouter/resolve/main/tests/test_ffprobe.py
711 Bytes
| from __future__ import annotations | |
| import shutil | |
| import wave | |
| import pytest | |
| from app.services.ffprobe_service import FFprobeService | |
| async def test_ffprobe_returns_audio_metadata(settings, tmp_path) -> None: | |
| audio = tmp_path / "tone.wav" | |
| with wave.open(str(audio), "wb") as stream: | |
| stream.setnchannels(1) | |
| stream.setsampwidth(2) | |
| stream.setframerate(8000) | |
| stream.writeframes(b"\x00\x00" * 8000) | |
| metadata = await FFprobeService(settings).probe(audio) | |
| assert metadata["duration"] == pytest.approx(1.0, abs=0.01) | |
| assert metadata["audio_streams"][0]["codec"] == "pcm_s16le" | |