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_mathutils.py (1 of 7 files). Show all

Unified · Split

python/tests/test_mathutils.py+9−9
@@ -12,7 +12,7 @@ class aubio_mathutils(TestCase): · 11 unmodified lines
12 def test_unwrap2pi(self):12 def test_unwrap2pi(self):
13 unwrap2pi(int(23))13 unwrap2pi(int(23))
14 unwrap2pi(float(23.))14 unwrap2pi(float(23.))
15 unwrap2pi(long(23.))15 unwrap2pi(int(23.))
16 unwrap2pi(arange(10))16 unwrap2pi(arange(10))
17 unwrap2pi(arange(10).astype("int"))17 unwrap2pi(arange(10).astype("int"))
18 unwrap2pi(arange(10).astype("float"))18 unwrap2pi(arange(10).astype("float"))
@@ -27,8 +27,8 @@ class aubio_mathutils(TestCase): · 8 unmodified lines
27 #print zip(a, b)27 #print zip(a, b)
28 28
29 try:29 try:
30 print unwrap2pi(["23.","24.",25.])30 print (unwrap2pi(["23.","24.",25.]))
31 except Exception, e:31 except Exception as e:
32 pass32 pass
33 33
34 def test_unwrap2pi_takes_fvec(self):34 def test_unwrap2pi_takes_fvec(self):
@@ -53,7 +53,7 @@ class aubio_mathutils(TestCase): · 18 unmodified lines
53 assert ( b <= pi ).all()53 assert ( b <= pi ).all()
54 54
55 def test_freqtomidi(self):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 b = freqtomidi(a)57 b = freqtomidi(a)
58 #print zip(a, b)58 #print zip(a, b)
59 assert_equal ( isnan(array(b)), False )59 assert_equal ( isnan(array(b)), False )
@@ -61,7 +61,7 @@ class aubio_mathutils(TestCase): · 1 unmodified line
61 assert_equal ( array(b) < 0, False )61 assert_equal ( array(b) < 0, False )
62 62
63 def test_miditofreq(self):63 def test_miditofreq(self):
64 a = range(-30, 200) + [-100000, 10000]64 a = list(range(-30, 200)) + [-100000, 10000]
65 b = miditofreq(a)65 b = miditofreq(a)
66 #print zip(a, b)66 #print zip(a, b)
67 assert_equal ( isnan(b), False )67 assert_equal ( isnan(b), False )
@@ -69,7 +69,7 @@ class aubio_mathutils(TestCase): · 1 unmodified line
69 assert_equal ( b < 0, False )69 assert_equal ( b < 0, False )
70 70
71 def test_miditobin(self):71 def test_miditobin(self):
72 a = range(-30, 200) + [-100000, 10000]72 a = list(range(-30, 200)) + [-100000, 10000]
73 b = [ bintomidi(x, 44100, 512) for x in a ]73 b = [ bintomidi(x, 44100, 512) for x in a ]
74 #print zip(a, b)74 #print zip(a, b)
75 assert_equal ( isnan(array(b)), False )75 assert_equal ( isnan(array(b)), False )
@@ -77,7 +77,7 @@ class aubio_mathutils(TestCase): · 1 unmodified line
77 assert_equal ( array(b) < 0, False )77 assert_equal ( array(b) < 0, False )
78 78
79 def test_bintomidi(self):79 def test_bintomidi(self):
80 a = range(-100, 512)80 a = list(range(-100, 512))
81 b = [ bintomidi(x, 44100, 512) for x in a ]81 b = [ bintomidi(x, 44100, 512) for x in a ]
82 #print zip(a, b)82 #print zip(a, b)
83 assert_equal ( isnan(array(b)), False )83 assert_equal ( isnan(array(b)), False )
@@ -85,7 +85,7 @@ class aubio_mathutils(TestCase): · 1 unmodified line
85 assert_equal ( array(b) < 0, False )85 assert_equal ( array(b) < 0, False )
86 86
87 def test_freqtobin(self):87 def test_freqtobin(self):
88 a = range(-20, 50000, 100) + [ -1e32, 1e32 ]88 a = list(range(-20, 50000, 100)) + [ -1e32, 1e32 ]
89 b = [ freqtobin(x, 44100, 512) for x in a ]89 b = [ freqtobin(x, 44100, 512) for x in a ]
90 #print zip(a, b)90 #print zip(a, b)
91 assert_equal ( isnan(array(b)), False )91 assert_equal ( isnan(array(b)), False )
@@ -93,7 +93,7 @@ class aubio_mathutils(TestCase): · 1 unmodified line
93 assert_equal ( array(b) < 0, False )93 assert_equal ( array(b) < 0, False )
94 94
95 def test_bintofreq(self):95 def test_bintofreq(self):
96 a = range(-20, 148)96 a = list(range(-20, 148))
97 b = [ bintofreq(x, 44100, 512) for x in a ]97 b = [ bintofreq(x, 44100, 512) for x in a ]
98 #print zip(a, b)98 #print zip(a, b)
99 assert_equal ( isnan(array(b)), False )99 assert_equal ( isnan(array(b)), False )

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