From: Paul Brossier Date: Mon, 2 May 2016 14:43:42 +0000 (+0200) Subject: python/tests/test_cvec.py: check input sizes X-Git-Tag: 0.4.4~300^2~134 X-Git-Url: https://git.aubio.org/?a=commitdiff_plain;h=cd5388875d11b8033e451b430cf7cefc9469d650;p=aubio.git python/tests/test_cvec.py: check input sizes --- diff --git a/python/tests/test_cvec.py b/python/tests/test_cvec.py index a645a14d..5a6ed9e6 100755 --- a/python/tests/test_cvec.py +++ b/python/tests/test_cvec.py @@ -2,7 +2,7 @@ from numpy.testing import TestCase from numpy.testing import assert_equal, assert_almost_equal -from aubio import cvec, float_type +from aubio import cvec, fvec, float_type import numpy as np class aubio_cvec_test_case(TestCase): @@ -78,6 +78,30 @@ class aubio_cvec_test_case(TestCase): assert_equal(new_spec.phas, 0.) del new_spec + def test_assign_norm_too_large(self): + a = cvec(512) + b = fvec(512//2+1 + 4) + with self.assertRaises(ValueError): + a.norm = b + + def test_assign_norm_too_small(self): + a = cvec(512) + b = fvec(512//2+1 - 4) + with self.assertRaises(ValueError): + a.norm = b + + def test_assign_phas_too_large(self): + a = cvec(512) + b = fvec(512//2+1 + 4) + with self.assertRaises(ValueError): + a.phas = b + + def test_assign_phas_too_small(self): + a = cvec(512) + b = fvec(512//2+1 - 4) + with self.assertRaises(ValueError): + a.phas = b + if __name__ == '__main__': from nose2 import main main()