History

python/tests/: prepare for python3 (see #33)

Paul Brossier committed 10 years ago

Commit 689106e1 parent 1c6fe647 files · +53 −53Browse files

Showing the changes to python/tests/test_source.py (1 of 7 files). Show all

Unified · Split

python/tests/test_source.py+11−11
@@ -38,10 +38,10 @@ class aubio_source_read_test_case(aubio_source_test_case_base): · 37 unmodified lines
38 vec, read = f()38 vec, read = f()
39 total_frames += read39 total_frames += read
40 if read < f.hop_size: break40 if read < f.hop_size: break
41 print "read", "%.2fs" % (total_frames / float(f.samplerate) ),41 print ("read", "%.2fs" % (total_frames / float(f.samplerate) ) ),
42 print "(", total_frames, "frames", "in",42 print ("(", total_frames, "frames", "in" ),
43 print total_frames / f.hop_size, "blocks", "at", "%dHz" % f.samplerate, ")",43 print (total_frames / f.hop_size, "blocks", "at", "%dHz" % f.samplerate, ")" ),
44 print "from", f.uri44 print ("from", f.uri)
45 return total_frames45 return total_frames
46 46
47 def test_samplerate_hopsize(self):47 def test_samplerate_hopsize(self):
@@ -67,7 +67,7 @@ class aubio_source_read_test_case(aubio_source_test_case_base): · 19 unmodified lines
67 for p in list_of_sounds:67 for p in list_of_sounds:
68 try:68 try:
69 f = source(p, -1)69 f = source(p, -1)
70 except ValueError, e:70 except ValueError as e:
71 pass71 pass
72 else:72 else:
73 self.fail('negative samplerate does not raise ValueError')73 self.fail('negative samplerate does not raise ValueError')
@@ -76,7 +76,7 @@ class aubio_source_read_test_case(aubio_source_test_case_base): · 2 unmodified lines
76 for p in list_of_sounds:76 for p in list_of_sounds:
77 try:77 try:
78 f = source(p, 0, -1)78 f = source(p, 0, -1)
79 except ValueError, e:79 except ValueError as e:
80 pass80 pass
81 else:81 else:
82 self.fail('negative hop_size does not raise ValueError')82 self.fail('negative hop_size does not raise ValueError')
@@ -108,11 +108,11 @@ class aubio_source_readmulti_test_case(aubio_source_read_test_case): · 25 unmodified lines
108 vec, read = f.do_multi()108 vec, read = f.do_multi()
109 total_frames += read109 total_frames += read
110 if read < f.hop_size: break110 if read < f.hop_size: break
111 print "read", "%.2fs" % (total_frames / float(f.samplerate) ),111 print ("read", "%.2fs" % (total_frames / float(f.samplerate) ) ),
112 print "(", total_frames, "frames", "in",112 print ("(", total_frames, "frames", "in" ),
113 print f.channels, "channels and",113 print (f.channels, "channels and" ),
114 print total_frames / f.hop_size, "blocks", "at", "%dHz" % f.samplerate, ")",114 print (total_frames / f.hop_size, "blocks", "at", "%dHz" % f.samplerate, ")" ),
115 print "from", f.uri115 print ("from", f.uri)
116 return total_frames116 return total_frames
117 117
118if __name__ == '__main__':118if __name__ == '__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