Skip to content

Commit f07ad42

Browse files
committed
Update path
1 parent a324c2d commit f07ad42

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

tests/test_data/speech/nearhou.wav

1.26 MB
Binary file not shown.

tests/test_data/speech/sleep.wav

1.26 MB
Binary file not shown.

tests/test_feature_extraction.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,22 @@
55
66
@author: jsingh
77
"""
8+
import os
89
import pytest
10+
from pathlib import Path
911
from pyAudioProcessing.extract_features import get_features
1012

1113
def test_get_features():
1214
"""
1315
Test get_features function
1416
"""
15-
features = get_features("data_samples/testing", ["gfcc", "mfcc"])
16-
assert "musc" in features
17+
test_root = str(Path(__file__).parent)
18+
data_dir = os.path.join(test_root, "test_data")
19+
features = get_features(data_dir, ["gfcc", "mfcc"])
1720
assert "speech" in features
18-
assert "data_samples/testing/speech/sleep.wav" in features["speech"]
19-
assert "features" in features["speech"]["data_samples/testing/speech/sleep.wav"]
20-
assert "feature_names" in features["speech"]["data_samples/testing/speech/sleep.wav"]
21-
assert "mfcc_1_mean" in features["speech"]["data_samples/testing/speech/sleep.wav"]["feature_names"]
22-
assert "gfcc_1_mean" in features["speech"]["data_samples/testing/speech/sleep.wav"]["feature_names"]
21+
assert len([i for i in features["speech"].keys() if "sleep.wav" in i]) > 0
22+
key = list(features["speech"].keys())[0]
23+
assert "features" in features["speech"][key]
24+
assert "feature_names" in features["speech"][key]
25+
assert "mfcc_1_mean" in features["speech"][key]["feature_names"]
26+
assert "gfcc_1_mean" in features["speech"][key]["feature_names"]

0 commit comments

Comments
 (0)