+ def test_cvec_repr(self):
+ win_s = 512
+ c = cvec(win_s)
+ expected_repr = "aubio cvec of {:d} elements".format(win_s//2+1)
+ self.assertEqual(repr(c), expected_repr)
+
+class aubio_cvec_wrong_norm_input(TestCase):
+
+ def test_wrong_length(self):
+ with self.assertRaises(ValueError):
+ cvec(-1)
+
+ def test_set_norm_with_scalar(self):
+ a = cvec(512)
+ with self.assertRaises(ValueError):
+ a.norm = 1
+
+ def test_set_norm_with_scalar_array(self):
+ a = cvec(512)
+ with self.assertRaises(ValueError):
+ a.norm = np.ndarray(1, dtype = 'int')
+
+ def test_set_norm_with_int_array(self):
+ a = cvec(512)
+ with self.assertRaises(ValueError):
+ a.norm = np.zeros(512//2+1, dtype = 'int')
+
+ def test_set_norm_with_wrong_float_array(self):
+ a = cvec(512)
+ with self.assertRaises(ValueError):
+ a.norm = np.zeros(512//2+1, dtype = wrong_type)
+
+ def test_set_norm_with_wrong_2d_array(self):
+ a = cvec(512)
+ with self.assertRaises(ValueError):
+ a.norm = np.zeros((512//2+1, 2), dtype = float_type)
+