Spaces:
Running
Running
| from unittest.mock import patch, MagicMock | |
| from pathlib import Path | |
| from separate import separate_vocals_to_mp3 | |
| def test_separate_returns_mp3_path(mock_encode, mock_demucs, tmp_path): | |
| audio = tmp_path / "in.m4a" | |
| audio.write_bytes(b"x") | |
| no_vocals_wav = tmp_path / "no_vocals.wav" | |
| no_vocals_wav.write_bytes(b"y") | |
| mock_demucs.return_value = no_vocals_wav | |
| out_mp3 = tmp_path / "no_vocals.mp3" | |
| mock_encode.return_value = out_mp3 | |
| result = separate_vocals_to_mp3(audio) | |
| assert result == out_mp3 | |
| mock_demucs.assert_called_once_with(audio) | |
| mock_encode.assert_called_once_with(no_vocals_wav, audio.parent / "no_vocals.mp3") | |