Showing the changes to python (1 of 1 file). Show all
Unified · Split
| @@ -2,7 +2,7 @@ · 1 unmodified line | |||
| 2 | 2 | ||
| 3 | from numpy.testing import TestCase | 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, float_type | 5 | from aubio import cvec, fvec, float_type |
| 6 | import numpy as np | 6 | import numpy as np |
| 7 | 7 | ||
| 8 | class aubio_cvec_test_case(TestCase): | 8 | class aubio_cvec_test_case(TestCase): |
| @@ -78,6 +78,30 @@ class aubio_cvec_test_case(TestCase): · 69 unmodified lines | |||
| 78 | assert_equal(new_spec.phas, 0.) | 78 | assert_equal(new_spec.phas, 0.) |
| 79 | del new_spec | 79 | del new_spec |
| 80 | 80 | ||
| 81 | def test_assign_norm_too_large(self): | ||
| 82 | a = cvec(512) | ||
| 83 | b = fvec(512//2+1 + 4) | ||
| 84 | with self.assertRaises(ValueError): | ||
| 85 | a.norm = b | ||
| 86 | |||
| 87 | def test_assign_norm_too_small(self): | ||
| 88 | a = cvec(512) | ||
| 89 | b = fvec(512//2+1 - 4) | ||
| 90 | with self.assertRaises(ValueError): | ||
| 91 | a.norm = b | ||
| 92 | |||
| 93 | def test_assign_phas_too_large(self): | ||
| 94 | a = cvec(512) | ||
| 95 | b = fvec(512//2+1 + 4) | ||
| 96 | with self.assertRaises(ValueError): | ||
| 97 | a.phas = b | ||
| 98 | |||
| 99 | def test_assign_phas_too_small(self): | ||
| 100 | a = cvec(512) | ||
| 101 | b = fvec(512//2+1 - 4) | ||
| 102 | with self.assertRaises(ValueError): | ||
| 103 | a.phas = b | ||
| 104 | |||
| 81 | if __name__ == '__main__': | 105 | if __name__ == '__main__': |
| 82 | from nose2 import main | 106 | from nose2 import main |
| 83 | main() | 107 | main() |