Ignore:
Timestamp:
Apr 18, 2016, 11:24:47 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:
6db7600
Parents:
1c6fe64
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/tests/test_fvec.py

    r1c6fe64 r689106e  
    2020        assert a.dtype == 'float32'
    2121        assert a.shape == (4,)
    22         assert_equal (range(4), a)
     22        assert_equal (list(range(4)), a)
    2323
    2424    def test_vector_assign_element(self):
     
    4242        a.T
    4343        array(a).T
    44         a = range(len(a))
     44        a = list(range(len(a)))
    4545
    4646    def test_wrong_values(self):
     
    5353    def test_alpha_norm_of_fvec(self):
    5454        a = fvec(2)
    55         self.assertEquals (alpha_norm(a, 1), 0)
     55        self.assertEqual (alpha_norm(a, 1), 0)
    5656        a[0] = 1
    57         self.assertEquals (alpha_norm(a, 1), 0.5)
     57        self.assertEqual (alpha_norm(a, 1), 0.5)
    5858        a[1] = 1
    59         self.assertEquals (alpha_norm(a, 1), 1)
     59        self.assertEqual (alpha_norm(a, 1), 1)
    6060        a = array([0, 1], dtype='float32')
    6161        from math import sqrt
     
    7474        # check 1d array
    7575        a = array(range(10), dtype = 'float32')
    76         self.assertEquals (alpha_norm(a, 1), 4.5)
     76        self.assertEqual (alpha_norm(a, 1), 4.5)
    7777
    7878    def test_alpha_norm_of_array_of_int(self):
     
    9292        assert_almost_equal (zero_crossing_rate(a), 1./3. )
    9393        a = array([0.]*100, dtype='float32')
    94         self.assertEquals (zero_crossing_rate(a), 0 )
     94        self.assertEqual (zero_crossing_rate(a), 0 )
    9595        a = array([-1.]*100, dtype='float32')
    96         self.assertEquals (zero_crossing_rate(a), 0 )
     96        self.assertEqual (zero_crossing_rate(a), 0 )
    9797        a = array([1.]*100, dtype='float32')
    98         self.assertEquals (zero_crossing_rate(a), 0 )
     98        self.assertEqual (zero_crossing_rate(a), 0 )
    9999
    100100    def test_alpha_norm_of_array_of_float64(self):
     
    106106        self.assertRaises (ValueError, alpha_norm, a, 1)
    107107        # check float64 1d array fail
    108         a = array(range(10), dtype = 'float64')
     108        a = array(list(range(10)), dtype = 'float64')
    109109        self.assertRaises (ValueError, alpha_norm, a, 1)
    110110        # 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')
    112112        self.assertRaises (ValueError, alpha_norm, a, 1)
    113113
Note: See TracChangeset for help on using the changeset viewer.