From 5164e2cebda46aed97d5e460e32eebe3df6b983b Mon Sep 17 00:00:00 2001 From: Joel Mathew Thomas <90510078+joelmathewthomas@users.noreply.github.com> Date: Sat, 11 Jan 2025 03:24:05 +0530 Subject: [PATCH] rename samples/ to test_audio, and move it to tests/ --- .../test_audio}/am_contra_heart_peripheral.wav | Bin {samples => tests/test_audio}/cafe_crowd_talk.aiff | Bin {samples => tests/test_audio}/cafe_crowd_talk.wav | Bin {samples => tests/test_audio}/miaow_16k.wav | Bin {samples => tests/test_audio}/speech_whistling2.wav | Bin {samples => tests/test_audio}/unsupported_file.txt | 0 tests/test_input.py | 6 +++--- tests/test_preprocessing.py | 6 +++--- tests/test_separation.py | 2 +- 9 files changed, 7 insertions(+), 7 deletions(-) rename {samples => tests/test_audio}/am_contra_heart_peripheral.wav (100%) rename {samples => tests/test_audio}/cafe_crowd_talk.aiff (100%) rename {samples => tests/test_audio}/cafe_crowd_talk.wav (100%) rename {samples => tests/test_audio}/miaow_16k.wav (100%) rename {samples => tests/test_audio}/speech_whistling2.wav (100%) rename {samples => tests/test_audio}/unsupported_file.txt (100%) diff --git a/samples/am_contra_heart_peripheral.wav b/tests/test_audio/am_contra_heart_peripheral.wav similarity index 100% rename from samples/am_contra_heart_peripheral.wav rename to tests/test_audio/am_contra_heart_peripheral.wav diff --git a/samples/cafe_crowd_talk.aiff b/tests/test_audio/cafe_crowd_talk.aiff similarity index 100% rename from samples/cafe_crowd_talk.aiff rename to tests/test_audio/cafe_crowd_talk.aiff diff --git a/samples/cafe_crowd_talk.wav b/tests/test_audio/cafe_crowd_talk.wav similarity index 100% rename from samples/cafe_crowd_talk.wav rename to tests/test_audio/cafe_crowd_talk.wav diff --git a/samples/miaow_16k.wav b/tests/test_audio/miaow_16k.wav similarity index 100% rename from samples/miaow_16k.wav rename to tests/test_audio/miaow_16k.wav diff --git a/samples/speech_whistling2.wav b/tests/test_audio/speech_whistling2.wav similarity index 100% rename from samples/speech_whistling2.wav rename to tests/test_audio/speech_whistling2.wav diff --git a/samples/unsupported_file.txt b/tests/test_audio/unsupported_file.txt similarity index 100% rename from samples/unsupported_file.txt rename to tests/test_audio/unsupported_file.txt diff --git a/tests/test_input.py b/tests/test_input.py index 6c1c9c6..189861e 100644 --- a/tests/test_input.py +++ b/tests/test_input.py @@ -3,11 +3,11 @@ from src.input.file_reader import read_audio from src.input.format_checker import is_supported_format def test_read_audio(): - file_path = "samples/cafe_crowd_talk.aiff" + file_path = "tests/test_audio/cafe_crowd_talk.aiff" audio, sr = read_audio(file_path) assert len(audio) > 0 assert sr > 0 def test_is_supported_format(): - assert is_supported_format("samples/cafe_crowd_talk.aiff") == True - assert is_supported_format("samples/unsupported_file.txt") == False \ No newline at end of file + assert is_supported_format("tests/test_audio/cafe_crowd_talk.aiff") == True + assert is_supported_format("tests/test_audio/unsupported_file.txt") == False \ No newline at end of file diff --git a/tests/test_preprocessing.py b/tests/test_preprocessing.py index e5baffb..bf98379 100644 --- a/tests/test_preprocessing.py +++ b/tests/test_preprocessing.py @@ -8,7 +8,7 @@ from src.input.file_reader import read_audio from src.preprocessing.resample import resample def test_normalize_audio(): - file_path = "samples/cafe_crowd_talk.aiff" + file_path = "tests/test_audio/cafe_crowd_talk.aiff" audio, _ = read_audio(file_path) normalized_audio = normalize_audio(audio) @@ -16,14 +16,14 @@ def test_normalize_audio(): assert normalized_audio.min() >= -1.0 def test_trim_audio(): - file_path = "samples/cafe_crowd_talk.aiff" + file_path = "tests/test_audio/cafe_crowd_talk.aiff" audio, sr = read_audio(file_path) trimmed_audio = trim_audio(audio, sr) assert len(trimmed_audio) <= len(audio) def test_classify(): - file_path = "samples/cafe_crowd_talk.wav" + file_path = "tests/test_audio/cafe_crowd_talk.wav" expected_class = "Speech" predicted_class = classify_audio(file_path) diff --git a/tests/test_separation.py b/tests/test_separation.py index c98ddf6..00c020a 100644 --- a/tests/test_separation.py +++ b/tests/test_separation.py @@ -14,7 +14,7 @@ def test_demucs_separation_with_preprocessing(): Test to ensure Demucs separation works with preprocessing and creates expected outputs. """ - input_file = "./samples/am_contra_heart_peripheral.wav" + input_file = "tests/test_audio/am_contra_heart_peripheral.wav" file_name = Path(input_file).stem output_path = "/tmp/demucs-test" waveform, samplerate = read_audio(input_file)