From 5b70ef466f08dbf0012186f25bfe3a8b4cd1bdf0 Mon Sep 17 00:00:00 2001 From: John Glover Date: Sun, 29 Jul 2012 20:39:34 +0100 Subject: [base] Clear new peak and partial lists with Frame.clear --- simpl/base.pyx | 2 ++ 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 -- cgit v1.2.3