Changeset 376d5e9

Ignore:
Timestamp:
Apr 18, 2016, 11:46:18 PM (5 years ago)
Branches:
feature/autosink, feature/constantq, feature/pitchshift, feature/pydocstrings, feature/timestretch, master, pitchshift, sampler, timestretch, yinfft+
Children:
Parents:
6db7600
Message:

tests/: continue python3 preparation

Location:
python/tests
Files:
5 edited

Unmodified
Removed
• python/tests/test_filterbank.py

 r6db7600 def test_set_coeffs(self): f = filterbank(40, 512) r = random.random([40, 512 / 2 + 1]).astype('float32') r = random.random([40, int(512 / 2) + 1]).astype('float32') f.set_coeffs(r) assert_equal (r, f.get_coeffs()) f = filterbank(40, 512) c = cvec(512) c.norm[:] = random.random((512 / 2 + 1,)).astype('float32') c.norm[:] = random.random((int(512 / 2) + 1,)).astype('float32') assert_equal( f(c), 0) f = filterbank(40, 512) c = cvec(512) r = random.random([40, 512 / 2 + 1]).astype('float32') r = random.random([40, int(512 / 2) + 1]).astype('float32') r /= r.sum() f.set_coeffs(r) c.norm[:] = random.random((512 / 2 + 1,)).astype('float32') c.norm[:] = random.random((int(512 / 2) + 1,)).astype('float32') assert_equal ( f(c) < 1., True ) assert_equal ( f(c) > 0., True ) c = cvec(512) f.set_mel_coeffs_slaney(44100) c.norm[:] = random.random((512 / 2 + 1,)).astype('float32') c.norm[:] = random.random((int(512 / 2) + 1,)).astype('float32') assert_equal ( f(c) < 1., True ) assert_equal ( f(c) > 0., True )
• python/tests/test_note2midi.py

 r6db7600 def test_freq2note(self): " make sure freq2note(441) == A4 " self.assertEquals("A4", freq2note(441)) self.assertEqual("A4", freq2note(441)) if __name__ == '__main__':
• python/tests/test_phasevoc.py

 r6db7600 f = pvoc (win_s, hop_s) t = fvec (hop_s) for time in range( 4 * win_s / hop_s ): for time in range( int ( 4 * win_s / hop_s ) ): s = f(t) r = f.rdo(s)
• python/tests/test_zero_crossing_rate.py

 r6db7600 def test_impulse(self): """ check zero crossing rate on a buffer with an impulse """ self.vector[buf_size / 2] = 1. self.vector[int(buf_size / 2)] = 1. self.assertEqual(0., zero_crossing_rate(self.vector)) def test_negative_impulse(self): """ check zero crossing rate on a buffer with a negative impulse """ self.vector[buf_size / 2] = -1. self.vector[int(buf_size / 2)] = -1. self.assertEqual(2./buf_size, zero_crossing_rate(self.vector)) def test_single(self): """ check zero crossing rate on single crossing """ self.vector[buf_size / 2 - 1] = 1. self.vector[buf_size / 2] = -1. self.vector[int(buf_size / 2) - 1] = 1. self.vector[int(buf_size / 2)] = -1. self.assertEqual(2./buf_size, zero_crossing_rate(self.vector)) def test_single_with_gap(self): """ check zero crossing rate on single crossing with a gap""" self.vector[buf_size / 2 - 2] = 1. self.vector[buf_size / 2] = -1. self.vector[int(buf_size / 2) - 2] = 1. self.vector[int(buf_size / 2)] = -1. self.assertEqual(2./buf_size, zero_crossing_rate(self.vector))
• python/tests/utils.py

 r6db7600 from numpy import array filename = os.path.join(os.path.dirname(__file__), filename) return array([line.split() for line in open(filename).readlines()], dtype = dtype) with open(filename) as f: lines = f.readlines() return array([line.split() for line in lines], dtype = dtype) def list_all_sounds(rel_dir):
Note: See TracChangeset for help on using the changeset viewer.