summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJohn Glover <john@john-glovers-macbook.local>2010-12-09 09:33:30 +0000
committerJohn Glover <john@john-glovers-macbook.local>2010-12-09 09:33:30 +0000
commitb27a8f7182edb2f9e15fd60e78d54fb9fd0c5472 (patch)
tree32edda899d27ee989f04b60e6d4499049886df78 /tests
parentc30b69f4889f6e633201b12787c99a0e1173d3c7 (diff)
downloadsimpl-b27a8f7182edb2f9e15fd60e78d54fb9fd0c5472.tar.gz
simpl-b27a8f7182edb2f9e15fd60e78d54fb9fd0c5472.tar.bz2
simpl-b27a8f7182edb2f9e15fd60e78d54fb9fd0c5472.zip
Updated test to use nose
Diffstat (limited to 'tests')
-rw-r--r--tests/lp.py32
1 files changed, 3 insertions, 29 deletions
diff --git a/tests/lp.py b/tests/lp.py
index c6051dd..8d80ba2 100644
--- a/tests/lp.py
+++ b/tests/lp.py
@@ -14,41 +14,15 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-import simpl
from simpl import lp
import numpy as np
-import matplotlib.pyplot as plt
-import unittest
-audio, sampling_rate = simpl.read_wav("audio/flute.wav")
-
-# take just the first few frames
-audio = audio_in[0:4096]
-# Peak detection and partial tracking using SMS
-pd = simpl.SndObjPeakDetection()
-pd.max_peaks = 60
-peaks = pd.find_peaks(audio)
-pt = simpl.MQPartialTracking()
-pt.max_partials = 60
-partials = pt.find_partials(peaks)
-simpl.plot.plot_partials(partials)
-plt.show()
-
-exit()
-
-
-class TestLP(unittest.TestCase):
- FLOAT_PRECISION = 3 # number of decimal places to check for accuracy
+class TestLP(object):
def test_predict(self):
"""test_predict"""
coefs = np.array([1,2,3,4,5])
test_signal = np.ones(5)
predictions = lp.predict(test_signal, coefs, 2)
- self.assertEquals(predictions[0], -sum(coefs))
- self.assertEquals(predictions[1], -sum(coefs[1:])-predictions[0])
-
-suite = unittest.TestSuite()
-suite.addTest(TestLP('test_predict'))
-unittest.TextTestRunner().run(suite)
-
+ assert predictions[0] == -sum(coefs)
+ assert predictions[1] == -sum(coefs[1:])-predictions[0]