CoolFace
Apppublic

Abd756/StemSense

sourceHugging Faceupdated 9mo agoView on Hugging Face
0likes
test_stems.py37 linesDownload Raw Back to tests
1import pytest2import os3import glob4from core.stems import StemSeparator5from core.downloader import AudioDownloader6from config import DOWNLOAD_DIR, STEMS_DIR7 8@pytest.fixture9def separator():10    return StemSeparator()11 12def test_separate_stems(separator):13    # Use the file specifically requested by the user14    audio_path = r"e:\Projects\Spotify_Project\test_downloads\Ek Raat - Vilen.mp3"15    16    # Check if the file exists before starting17    assert os.path.exists(audio_path), f"Input audio file not found at {audio_path}"18 19    # 2. Perform separation20    stems_path = separator.separate(audio_path)21    22    assert stems_path is not None23    assert os.path.exists(stems_path)24    25    # 3. Verify the 4 default stems exist and print info26    print("\n--- Stem Extraction Results ---")27    expected_stems = ["vocals.wav", "drums.wav", "bass.wav", "other.wav"]28    for stem in expected_stems:29        stem_file = os.path.join(stems_path, stem)30        assert os.path.exists(stem_file), f"Missing stem: {stem}"31        32        # Calculate size in MB for the success message33        size_mb = os.path.getsize(stem_file) / (1024 * 1024)34        print(f"File: {stem:<12} | Size: {size_mb:>6.2f} MB")35 36    print(f"\n[SUCCESS] All 4 stems verified in: {stems_path}")37