Showing the changes to python/tests (1 of 1 file). Show all
Unified · Split
| @@ -1,16 +1,16 @@ | |||
| 1 | #! /usr/bin/env python | 1 | #! /usr/bin/env python |
| 2 | 2 | ||
| 3 | from numpy.testing import TestCase, run_module_suite | 3 | from numpy.testing import TestCase |
| 4 | from numpy.testing import assert_equal, assert_almost_equal | 4 | from numpy.testing import assert_equal, assert_almost_equal |
| 5 | from aubio import cvec | 5 | from aubio import cvec, float_type |
| 6 | from numpy import array, shape, pi | 6 | import numpy as np |
| 7 | 7 | ||
| 8 | class aubio_cvec_test_case(TestCase): | 8 | class aubio_cvec_test_case(TestCase): |
| 9 | 9 | ||
| 10 | def test_vector_created_with_zeroes(self): | 10 | def test_vector_created_with_zeroes(self): |
| 11 | a = cvec(10) | 11 | a = cvec(10) |
| 12 | shape(a.norm) | 12 | assert_equal(a.norm.shape[0], 10 / 2 + 1) |
| 13 | shape(a.phas) | 13 | assert_equal(a.phas.shape[0], 10 / 2 + 1) |
| 14 | a.norm[0] | 14 | a.norm[0] |
| 15 | assert_equal(a.norm, 0.) | 15 | assert_equal(a.norm, 0.) |
| 16 | assert_equal(a.phas, 0.) | 16 | assert_equal(a.phas, 0.) |
| @@ -41,11 +41,11 @@ class aubio_cvec_test_case(TestCase): · 24 unmodified lines | |||
| 41 | 41 | ||
| 42 | def test_assign_cvec_phas_slice(self): | 42 | def test_assign_cvec_phas_slice(self): |
| 43 | spec = cvec(1024) | 43 | spec = cvec(1024) |
| 44 | spec.phas[39:-1] = -pi | 44 | spec.phas[39:-1] = -np.pi |
| 45 | assert_equal(spec.phas[0:39], 0) | 45 | assert_equal(spec.phas[0:39], 0) |
| 46 | assert_equal(spec.phas[39:-1], -pi) | 46 | assert_equal(spec.phas[39:-1], -np.pi) |
| 47 | assert_equal(spec.norm, 0) | 47 | assert_equal(spec.norm, 0) |
| 48 | 48 | ||
| 49 | if __name__ == '__main__': | 49 | if __name__ == '__main__': |
| 50 | from unittest import main | 50 | from nose2 import main |
| 51 | main() | 51 | main() |