- Timestamp:
- Apr 18, 2016, 11:24:47 PM (9 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
- Location:
- python/tests
- Files:
-
- 7 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 -
python/tests/test_mathutils.py
r1c6fe64 r689106e 13 13 unwrap2pi(int(23)) 14 14 unwrap2pi(float(23.)) 15 unwrap2pi( long(23.))15 unwrap2pi(int(23.)) 16 16 unwrap2pi(arange(10)) 17 17 unwrap2pi(arange(10).astype("int")) … … 28 28 29 29 try: 30 print unwrap2pi(["23.","24.",25.])31 except Exception ,e:30 print (unwrap2pi(["23.","24.",25.])) 31 except Exception as e: 32 32 pass 33 33 … … 54 54 55 55 def test_freqtomidi(self): 56 a = array( range(-20, 50000, 100) + [ -1e32, 1e32 ])56 a = array(list(range(-20, 50000, 100)) + [ -1e32, 1e32 ]) 57 57 b = freqtomidi(a) 58 58 #print zip(a, b) … … 62 62 63 63 def test_miditofreq(self): 64 a = range(-30, 200) + [-100000, 10000]64 a = list(range(-30, 200)) + [-100000, 10000] 65 65 b = miditofreq(a) 66 66 #print zip(a, b) … … 70 70 71 71 def test_miditobin(self): 72 a = range(-30, 200) + [-100000, 10000]72 a = list(range(-30, 200)) + [-100000, 10000] 73 73 b = [ bintomidi(x, 44100, 512) for x in a ] 74 74 #print zip(a, b) … … 78 78 79 79 def test_bintomidi(self): 80 a = range(-100, 512)80 a = list(range(-100, 512)) 81 81 b = [ bintomidi(x, 44100, 512) for x in a ] 82 82 #print zip(a, b) … … 86 86 87 87 def test_freqtobin(self): 88 a = range(-20, 50000, 100) + [ -1e32, 1e32 ]88 a = list(range(-20, 50000, 100)) + [ -1e32, 1e32 ] 89 89 b = [ freqtobin(x, 44100, 512) for x in a ] 90 90 #print zip(a, b) … … 94 94 95 95 def test_bintofreq(self): 96 a = range(-20, 148)96 a = list(range(-20, 148)) 97 97 b = [ bintofreq(x, 44100, 512) for x in a ] 98 98 #print zip(a, b) -
python/tests/test_musicutils.py
r1c6fe64 r689106e 18 18 try: 19 19 window(10, 1024) 20 except ValueError ,e:20 except ValueError as e: 21 21 pass 22 22 else: … … 26 26 try: 27 27 window("default", "default") 28 except ValueError ,e:28 except ValueError as e: 29 29 pass 30 30 else: … … 44 44 try: 45 45 level_lin("default") 46 except ValueError ,e:46 except ValueError as e: 47 47 pass 48 48 else: … … 63 63 try: 64 64 db_spl("default") 65 except ValueError ,e:65 except ValueError as e: 66 66 pass 67 67 else: … … 83 83 try: 84 84 silence_detection("default", -70) 85 except ValueError ,e:85 except ValueError as e: 86 86 pass 87 87 else: … … 103 103 try: 104 104 level_detection("default", -70) 105 except ValueError ,e:105 except ValueError as e: 106 106 pass 107 107 else: -
python/tests/test_phasevoc.py
r1c6fe64 r689106e 64 64 zeros = fvec(hop_s) 65 65 f = pvoc(buf_s, hop_s) 66 for i in xrange(hop_s):66 for i in range(hop_s): 67 67 sigin[i] = random() * 2. - 1. 68 68 t2 = f.rdo( f(sigin) ) -
python/tests/test_pitch.py
r1c6fe64 r689106e 25 25 p = pitch('default', 2048, 512, 32000) 26 26 f = fvec (512) 27 for i in xrange(10): assert_equal (p(f), 0.)27 for i in range(10): assert_equal (p(f), 0.) 28 28 29 29 def test_run_on_ones(self): … … 32 32 f = fvec (512) 33 33 f[:] = 1 34 for i in xrange(10): assert_equal (p(f), 0.)34 for i in range(10): assert_equal (p(f), 0.) 35 35 36 36 class aubio_pitch_Sinusoid(TestCase): -
python/tests/test_sink.py
r1c6fe64 r689106e 45 45 vec = fvec(write) 46 46 g(vec, write) 47 except StandardError:47 except Exception: 48 48 pass 49 49 else: … … 71 71 if read < f.hop_size: break 72 72 if 0: 73 print "read", "%.2fs" % (total_frames / float(f.samplerate) ),74 print "(", total_frames, "frames", "in",75 print total_frames / f.hop_size, "blocks", "at", "%dHz" % f.samplerate, ")",76 print "from", f.uri,77 print "to", g.uri73 print ("read", "%.2fs" % (total_frames / float(f.samplerate) ) ), 74 print ("(", total_frames, "frames", "in" ), 75 print (total_frames / f.hop_size, "blocks", "at", "%dHz" % f.samplerate, ")" ), 76 print ("from", f.uri ), 77 print ("to", g.uri) 78 78 del_tmp_sink_path(sink_path) 79 79 … … 96 96 if read < f.hop_size: break 97 97 if 0: 98 print "read", "%.2fs" % (total_frames / float(f.samplerate) ),99 print "(", total_frames, "frames", "in",100 print f.channels, "channels", "in",101 print total_frames / f.hop_size, "blocks", "at", "%dHz" % f.samplerate, ")",102 print "from", f.uri,103 print "to", g.uri,104 print "in", g.channels, "channels"98 print ("read", "%.2fs" % (total_frames / float(f.samplerate) ) ), 99 print ("(", total_frames, "frames", "in" ), 100 print (f.channels, "channels", "in" ), 101 print (total_frames / f.hop_size, "blocks", "at", "%dHz" % f.samplerate, ")" ), 102 print ("from", f.uri ), 103 print ("to", g.uri ), 104 print ("in", g.channels, "channels") 105 105 del_tmp_sink_path(sink_path) 106 106 -
python/tests/test_source.py
r1c6fe64 r689106e 39 39 total_frames += read 40 40 if read < f.hop_size: break 41 print "read", "%.2fs" % (total_frames / float(f.samplerate) ),42 print "(", total_frames, "frames", "in",43 print total_frames / f.hop_size, "blocks", "at", "%dHz" % f.samplerate, ")",44 print "from", f.uri41 print ("read", "%.2fs" % (total_frames / float(f.samplerate) ) ), 42 print ("(", total_frames, "frames", "in" ), 43 print (total_frames / f.hop_size, "blocks", "at", "%dHz" % f.samplerate, ")" ), 44 print ("from", f.uri) 45 45 return total_frames 46 46 … … 68 68 try: 69 69 f = source(p, -1) 70 except ValueError ,e:70 except ValueError as e: 71 71 pass 72 72 else: … … 77 77 try: 78 78 f = source(p, 0, -1) 79 except ValueError ,e:79 except ValueError as e: 80 80 pass 81 81 else: … … 109 109 total_frames += read 110 110 if read < f.hop_size: break 111 print "read", "%.2fs" % (total_frames / float(f.samplerate) ),112 print "(", total_frames, "frames", "in",113 print f.channels, "channels and",114 print total_frames / f.hop_size, "blocks", "at", "%dHz" % f.samplerate, ")",115 print "from", f.uri111 print ("read", "%.2fs" % (total_frames / float(f.samplerate) ) ), 112 print ("(", total_frames, "frames", "in" ), 113 print (f.channels, "channels and" ), 114 print (total_frames / f.hop_size, "blocks", "at", "%dHz" % f.samplerate, ")" ), 115 print ("from", f.uri) 116 116 return total_frames 117 117
Note: See TracChangeset
for help on using the changeset viewer.