diff options
author | John Glover <j@johnglover.net> | 2012-07-29 20:39:34 +0100 |
---|---|---|
committer | John Glover <j@johnglover.net> | 2012-07-29 20:39:34 +0100 |
commit | 5b70ef466f08dbf0012186f25bfe3a8b4cd1bdf0 (patch) | |
tree | 2f6e8ac47d1810d668bea3612061e9995bf9682a | |
parent | 6780446f3c6ace7cfbeafdf0b9145ee2fc7b590a (diff) | |
download | simpl-5b70ef466f08dbf0012186f25bfe3a8b4cd1bdf0.tar.gz simpl-5b70ef466f08dbf0012186f25bfe3a8b4cd1bdf0.tar.bz2 simpl-5b70ef466f08dbf0012186f25bfe3a8b4cd1bdf0.zip |
[base] Clear new peak and partial lists with Frame.clear
-rw-r--r-- | simpl/base.pyx | 2 | ||||
-rw-r--r-- | tests/test_base.py | 9 |
2 files changed, 5 insertions, 6 deletions
diff --git a/simpl/base.pyx b/simpl/base.pyx index c86c2e5..d19b477 100644 --- a/simpl/base.pyx +++ b/simpl/base.pyx @@ -77,6 +77,8 @@ cdef class Frame: def clear(self): self.thisptr.clear() + self._peaks = [] + self._partials = [] # partials property max_partials: diff --git a/tests/test_base.py b/tests/test_base.py index 9d3173a..6cd2d39 100644 --- a/tests/test_base.py +++ b/tests/test_base.py @@ -40,18 +40,15 @@ class TestFrame(object): p.phase = 0.0 f = base.Frame() - assert f.num_peaks == 0 + assert len(f.peaks) == 0 assert f.max_peaks > 0 - f.add_peak(p) + f.peaks = [p] - assert f.num_peaks == 1 - assert_almost_equals(f.peak(0).amplitude, p.amplitude, - float_precision) assert_almost_equals(f.peaks[0].amplitude, p.amplitude, float_precision) f.clear() - assert f.num_peaks == 0 + assert len(f.peaks) == 0 def test_partials(self): N = 256 |