Changeset 8a49bb9


Ignore:
Timestamp:
Nov 30, 2016, 6:39:41 PM (3 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/constantq, feature/pitchshift, feature/pydocstrings, feature/timestretch, master, sampler, yinfft+
Children:
a0a073f
Parents:
261836d
Message:

python/tests/test_source.py: remove fragile brownnoise test, check duration on short files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/tests/test_source.py

    r261836d r8a49bb9  
    5757            if read < f.hop_size:
    5858                assert_equal(samples[read:], 0)
    59                 if 'brownnoise' in f.uri:
    60                     self.assertEquals(np.count_nonzero(samples[:read]), read)
    6159                break
    6260        #result_str = "read {:.2f}s ({:d} frames in {:d} blocks at {:d}Hz) from {:s}"
     
    7270            self.skipTest('failed opening with hop_s = {:d}, samplerate = {:d} ({:s})'.format(hop_size, samplerate, str(e)))
    7371        assert f.samplerate != 0
    74         self.read_from_source(f)
     72        read_frames = self.read_from_source(f)
     73        if 'f_' in soundfile and samplerate == 0:
     74            import re
     75            f = re.compile('.*_\([0:9]*f\)_.*')
     76            match_f = re.findall('([0-9]*)f_', soundfile)
     77            if len(match_f) == 1:
     78                expected_frames = int(match_f[0])
     79                self.assertEqual(expected_frames, read_frames)
    7580
    7681    @params(*list_of_sounds)
     
    159164            if read < f.hop_size:
    160165                assert_equal(samples[:,read:], 0)
    161                 if 'brownnoise' in f.uri:
    162                     self.assertEquals(np.count_nonzero(samples[:,:read]), read)
    163166                break
    164167        #result_str = "read {:.2f}s ({:d} frames in {:d} channels and {:d} blocks at {:d}Hz) from {:s}"
Note: See TracChangeset for help on using the changeset viewer.