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 (1 of 1 file). Show all

Unified · Split

python/tests/test_cvec.py+25−1
@@ -2,7 +2,7 @@ · 1 unmodified line
22
33 from numpy.testing import TestCase
44 from numpy.testing import assert_equal, assert_almost_equal
5−from aubio import cvec, float_type
5+from aubio import cvec, fvec, float_type
66 import numpy as np
77
88 class aubio_cvec_test_case(TestCase):
@@ -78,6 +78,30 @@ class aubio_cvec_test_case(TestCase): · 69 unmodified lines
7878 assert_equal(new_spec.phas, 0.)
7979 del new_spec
8080
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+
81105 if __name__ == '__main__':
82106 from nose2 import main
83107 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