History

python/tests/test_cvec.py: check input sizes

Paul Brossier committed 10 years ago

Commit cd538881 parent 3bf80b91 file · +25 −1Browse files

Showing the changes to python/tests (1 of 1 file). Show all

Unified · Split

python/tests/test_cvec.py+25−1
@@ -2,7 +2,7 @@ · 1 unmodified line
2 2
3from numpy.testing import TestCase3from numpy.testing import TestCase
4from numpy.testing import assert_equal, assert_almost_equal4from numpy.testing import assert_equal, assert_almost_equal
5from aubio import cvec, float_type5from aubio import cvec, fvec, float_type
6import numpy as np6import numpy as np
7 7
8class aubio_cvec_test_case(TestCase):8class 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_spec79 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
81if __name__ == '__main__':105if __name__ == '__main__':
82 from nose2 import main106 from nose2 import main
83 main()107 main()

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t