Showing the changes to python/tests/test_mathutils.py (1 of 7 files). Show all
Unified · Split
| @@ -12,7 +12,7 @@ class aubio_mathutils(TestCase): · 11 unmodified lines | ||
| 12 | 12 | def test_unwrap2pi(self): |
| 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")) |
| 18 | 18 | unwrap2pi(arange(10).astype("float")) |
| @@ -27,8 +27,8 @@ class aubio_mathutils(TestCase): · 8 unmodified lines | ||
| 27 | 27 | #print zip(a, b) |
| 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 | |
| 34 | 34 | def test_unwrap2pi_takes_fvec(self): |
| @@ -53,7 +53,7 @@ class aubio_mathutils(TestCase): · 18 unmodified lines | ||
| 53 | 53 | assert ( b <= pi ).all() |
| 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) |
| 59 | 59 | assert_equal ( isnan(array(b)), False ) |
| @@ -61,7 +61,7 @@ class aubio_mathutils(TestCase): · 1 unmodified line | ||
| 61 | 61 | assert_equal ( array(b) < 0, False ) |
| 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) |
| 67 | 67 | assert_equal ( isnan(b), False ) |
| @@ -69,7 +69,7 @@ class aubio_mathutils(TestCase): · 1 unmodified line | ||
| 69 | 69 | assert_equal ( b < 0, False ) |
| 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) |
| 75 | 75 | assert_equal ( isnan(array(b)), False ) |
| @@ -77,7 +77,7 @@ class aubio_mathutils(TestCase): · 1 unmodified line | ||
| 77 | 77 | assert_equal ( array(b) < 0, False ) |
| 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) |
| 83 | 83 | assert_equal ( isnan(array(b)), False ) |
| @@ -85,7 +85,7 @@ class aubio_mathutils(TestCase): · 1 unmodified line | ||
| 85 | 85 | assert_equal ( array(b) < 0, False ) |
| 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) |
| 91 | 91 | assert_equal ( isnan(array(b)), False ) |
| @@ -93,7 +93,7 @@ class aubio_mathutils(TestCase): · 1 unmodified line | ||
| 93 | 93 | assert_equal ( array(b) < 0, False ) |
| 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) |
| 99 | 99 | assert_equal ( isnan(array(b)), False ) |