Ignore:
Timestamp:
Jun 22, 2016, 1:00:10 PM (8 years ago)
Author:
Paul Brossier <piem@piem.org>
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:
4b9443c4
Parents:
60fc05b (diff), 6769586 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' into notes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/tests/test_mathutils.py

    r60fc05b rf264b17  
    11#! /usr/bin/env python
    22
     3from unittest import main
    34from numpy.testing import TestCase, assert_equal
    45from numpy import array, arange, isnan, isinf
     
    1314        unwrap2pi(int(23))
    1415        unwrap2pi(float(23.))
    15         unwrap2pi(long(23.))
     16        unwrap2pi(int(23.))
    1617        unwrap2pi(arange(10))
    1718        unwrap2pi(arange(10).astype("int"))
     
    2425        unwrap2pi(a)
    2526        a = pi/100. * arange(-600,600).astype("float")
    26         b = unwrap2pi (a)
     27        unwrap2pi(a)
    2728        #print zip(a, b)
    2829
    29         try:
    30             print unwrap2pi(["23.","24.",25.])
    31         except Exception, e:
    32             pass
     30    def test_unwrap2pi_fails_on_list(self):
     31        with self.assertRaises((TypeError, NotImplementedError)):
     32            unwrap2pi(["23.","24.",25.])
    3333
    3434    def test_unwrap2pi_takes_fvec(self):
     
    5454
    5555    def test_freqtomidi(self):
    56         a = array(range(-20, 50000, 100) + [ -1e32, 1e32 ])
     56        a = array(list(range(-20, 50000, 100)) + [ -1e32, 1e32 ])
    5757        b = freqtomidi(a)
    5858        #print zip(a, b)
     
    6262
    6363    def test_miditofreq(self):
    64         a = range(-30, 200) + [-100000, 10000]
     64        a = list(range(-30, 200)) + [-100000, 10000]
    6565        b = miditofreq(a)
    6666        #print zip(a, b)
     
    7070
    7171    def test_miditobin(self):
    72         a = range(-30, 200) + [-100000, 10000]
    73         b = [ bintomidi(x, 44100, 512) for x in a ]
     72        a = list(range(-30, 200)) + [-100000, 10000]
     73        b = [ miditobin(x, 44100, 512) for x in a ]
    7474        #print zip(a, b)
    7575        assert_equal ( isnan(array(b)), False )
     
    7878
    7979    def test_bintomidi(self):
    80         a = range(-100, 512)
     80        a = list(range(-100, 512))
    8181        b = [ bintomidi(x, 44100, 512) for x in a ]
    8282        #print zip(a, b)
     
    8686
    8787    def test_freqtobin(self):
    88         a = range(-20, 50000, 100) + [ -1e32, 1e32 ]
     88        a = list(range(-20, 50000, 100)) + [ -1e32, 1e32 ]
    8989        b = [ freqtobin(x, 44100, 512) for x in a ]
    9090        #print zip(a, b)
     
    9494
    9595    def test_bintofreq(self):
    96         a = range(-20, 148)
     96        a = list(range(-20, 148))
    9797        b = [ bintofreq(x, 44100, 512) for x in a ]
    9898        #print zip(a, b)
     
    102102
    103103if __name__ == '__main__':
    104     from unittest import main
    105104    main()
Note: See TracChangeset for help on using the changeset viewer.