File tree Expand file tree Collapse file tree 3 files changed +11
-7
lines changed
Expand file tree Collapse file tree 3 files changed +11
-7
lines changed Original file line number Diff line number Diff line change 55
66@author: jsingh
77"""
8+ import os
89import pytest
10+ from pathlib import Path
911from pyAudioProcessing .extract_features import get_features
1012
1113def 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" ]
You can’t perform that action at this time.
0 commit comments