Changeset 208336b for python/tests
- Timestamp:
- Mar 5, 2013, 8:55:29 AM (12 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
- Children:
- ad5203c
- Parents:
- f50e534
- Location:
- python/tests
- Files:
-
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
python/tests/test_hist.py.old
rf50e534 r208336b 1 from template import aubio_unit_template 2 from localaubio import * 1 #! /usr/bin/env python 2 3 from numpy.testing import TestCase, assert_equal, assert_almost_equal 4 from aubio import fvec, digital_filter 3 5 import random 4 6 … … 10 12 nelems = 1000 11 13 12 class hist_ unit(aubio_unit_template):14 class hist_test_case(TestCase): 13 15 14 16 def setUp(self): … … 63 65 """ test hist on constant under lower limit """ 64 66 """ this returns 0 because constant is out of range """ 65 input = new_fvec(buf_size, channels)67 vec_in = fvec(buf_size) 66 68 constant = flow - 1. 67 fvec_write_sample(input,constant,0,0)69 vec_in[0] = constant 68 70 aubio_hist_do_notnull(self.o, input) 69 71 self.assertCloseEnough(0., aubio_hist_mean(self.o)) -
python/tests/test_zero_crossing_rate.py.old
rf50e534 r208336b 1 from template import aubio_unit_template 2 from localaubio import * 1 from aubio import zero_crossing_rate 2 3 #! /usr/bin/env python 4 5 from numpy.testing import TestCase 3 6 4 7 buf_size = 2048 5 8 channels = 1 6 9 7 class zero_crossing_rate_ unit(unittest.TestCase):10 class zero_crossing_rate_test_case(TestCase): 8 11 9 12 def setUp(self): … … 19 22 def test_zeroes(self): 20 23 """ check zero crossing rate on a buffer of 0. """ 21 self.assertEqual(0., aubio_zero_crossing_rate(self.vector))24 self.assertEqual(0., zero_crossing_rate(self.vector)) 22 25 23 26 def test_ones(self): … … 26 29 for channel in range(channels): 27 30 fvec_write_sample(self.vector, 1., channel, index) 28 self.assertEqual(0., aubio_zero_crossing_rate(self.vector))31 self.assertEqual(0., zero_crossing_rate(self.vector)) 29 32 30 33 def test_impulse(self): 31 34 """ check zero crossing rate on a buffer with an impulse """ 32 35 fvec_write_sample(self.vector, 1., 0, buf_size / 2) 33 self.assertEqual(0., aubio_zero_crossing_rate(self.vector))36 self.assertEqual(0., zero_crossing_rate(self.vector)) 34 37 35 38 def test_negative_impulse(self): 36 39 """ check zero crossing rate on a buffer with a negative impulse """ 37 40 fvec_write_sample(self.vector, -1., 0, buf_size / 2) 38 self.assertEqual(2./buf_size, aubio_zero_crossing_rate(self.vector))41 self.assertEqual(2./buf_size, zero_crossing_rate(self.vector)) 39 42 40 43 def test_single(self): … … 42 45 fvec_write_sample(self.vector, +1., 0, buf_size / 2 - 1) 43 46 fvec_write_sample(self.vector, -1., 0, buf_size / 2) 44 self.assertEqual(2./buf_size, aubio_zero_crossing_rate(self.vector))47 self.assertEqual(2./buf_size, zero_crossing_rate(self.vector)) 45 48 46 49 def test_single_with_gap(self): … … 48 51 fvec_write_sample(self.vector, +1., 0, buf_size / 2 - 2) 49 52 fvec_write_sample(self.vector, -1., 0, buf_size / 2) 50 self.assertEqual(2./buf_size, aubio_zero_crossing_rate(self.vector))53 self.assertEqual(2./buf_size, zero_crossing_rate(self.vector)) 51 54 52 55 if __name__ == '__main__':
Note: See TracChangeset
for help on using the changeset viewer.