Changeset 689106e for python/tests/test_fvec.py
- Timestamp:
- Apr 18, 2016, 11:24:47 PM (8 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
- Children:
- 6db7600
- Parents:
- 1c6fe64
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/tests/test_fvec.py
r1c6fe64 r689106e 20 20 assert a.dtype == 'float32' 21 21 assert a.shape == (4,) 22 assert_equal ( range(4), a)22 assert_equal (list(range(4)), a) 23 23 24 24 def test_vector_assign_element(self): … … 42 42 a.T 43 43 array(a).T 44 a = range(len(a))44 a = list(range(len(a))) 45 45 46 46 def test_wrong_values(self): … … 53 53 def test_alpha_norm_of_fvec(self): 54 54 a = fvec(2) 55 self.assertEqual s(alpha_norm(a, 1), 0)55 self.assertEqual (alpha_norm(a, 1), 0) 56 56 a[0] = 1 57 self.assertEqual s(alpha_norm(a, 1), 0.5)57 self.assertEqual (alpha_norm(a, 1), 0.5) 58 58 a[1] = 1 59 self.assertEqual s(alpha_norm(a, 1), 1)59 self.assertEqual (alpha_norm(a, 1), 1) 60 60 a = array([0, 1], dtype='float32') 61 61 from math import sqrt … … 74 74 # check 1d array 75 75 a = array(range(10), dtype = 'float32') 76 self.assertEqual s(alpha_norm(a, 1), 4.5)76 self.assertEqual (alpha_norm(a, 1), 4.5) 77 77 78 78 def test_alpha_norm_of_array_of_int(self): … … 92 92 assert_almost_equal (zero_crossing_rate(a), 1./3. ) 93 93 a = array([0.]*100, dtype='float32') 94 self.assertEqual s(zero_crossing_rate(a), 0 )94 self.assertEqual (zero_crossing_rate(a), 0 ) 95 95 a = array([-1.]*100, dtype='float32') 96 self.assertEqual s(zero_crossing_rate(a), 0 )96 self.assertEqual (zero_crossing_rate(a), 0 ) 97 97 a = array([1.]*100, dtype='float32') 98 self.assertEqual s(zero_crossing_rate(a), 0 )98 self.assertEqual (zero_crossing_rate(a), 0 ) 99 99 100 100 def test_alpha_norm_of_array_of_float64(self): … … 106 106 self.assertRaises (ValueError, alpha_norm, a, 1) 107 107 # check float64 1d array fail 108 a = array( range(10), dtype = 'float64')108 a = array(list(range(10)), dtype = 'float64') 109 109 self.assertRaises (ValueError, alpha_norm, a, 1) 110 110 # check float64 2d array fail 111 a = array([ range(10), range(10)], dtype = 'float64')111 a = array([list(range(10)), list(range(10))], dtype = 'float64') 112 112 self.assertRaises (ValueError, alpha_norm, a, 1) 113 113
Note: See TracChangeset
for help on using the changeset viewer.