1 from numpy.testing import TestCase, run_module_suite
2 from numpy.testing import assert_equal, assert_almost_equal
4 from numpy import array, shape, pi
6 class aubio_cvec_test_case(TestCase):
8 def test_vector_created_with_zeroes(self):
14 assert_equal(a.norm, 0.)
15 assert_equal(a.phas, 0.)
17 def test_vector_assign_element(self):
20 assert_equal(a.norm[0], 1)
22 assert_equal(a.phas[0], 1)
24 def test_vector_assign_element_end(self):
27 assert_equal(a.norm[-1], 1)
28 assert_equal(a.norm[len(a.norm)-1], 1)
30 assert_equal(a.phas[-1], 1)
31 assert_equal(a.phas[len(a.phas)-1], 1)
33 def test_assign_cvec_norm_slice(self):
35 spec.norm[40:100] = 100
36 assert_equal (spec.norm[0:40], 0)
37 assert_equal (spec.norm[40:100], 100)
38 assert_equal (spec.norm[100:-1], 0)
39 assert_equal (spec.phas, 0)
41 def test_assign_cvec_phas_slice(self):
43 spec.phas[39:-1] = -pi
44 assert_equal (spec.phas[0:39], 0)
45 assert_equal (spec.phas[39:-1], -pi)
46 assert_equal (spec.norm, 0)
48 if __name__ == '__main__':
49 from unittest import main