-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun_tests.py
41 lines (28 loc) · 929 Bytes
/
run_tests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import unittest
import numpy as np
from bandwidthestimation import BandwidthEstimator
class TestBandwidthEstimation(unittest.TestCase):
def test_init(self):
BandwidthEstimator()
def test_execution(self):
medianame = "./audiofiles/poeme_full.wav"
bwe = BandwidthEstimator()
bwe(medianame)
def test_damaged_thresh(self):
thresh = 0.99
damaged_freq = 5885.3
medianame = "./audiofiles/poeme_damaged.wav"
bwe = BandwidthEstimator(
thresholds=[thresh]
)
output = bwe(medianame, uem=[(2, 12)])
res = output["frequencies"][0]
np.testing.assert_almost_equal(
res[1],
damaged_freq,
decimal=2,
err_msg="Frequencies are not equal (thresh : %f)" % thresh
)
# Run tests
if __name__ == '__main__':
unittest.main()