Mercurial > hg > auditok
changeset 128:3594fdb0703d
Add tests for _load_raw missing audio parameter
author | Amine Sehili <amine.sehili@gmail.com> |
---|---|
date | Wed, 06 Feb 2019 20:28:31 +0100 |
parents | 7db4af2fefe4 |
children | fb31a7250402 |
files | tests/test_io.py |
diffstat | 1 files changed, 13 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/test_io.py Wed Feb 06 20:17:42 2019 +0100 +++ b/tests/test_io.py Wed Feb 06 20:28:31 2019 +0100 @@ -12,6 +12,7 @@ AudioParameterError, BufferAudioSource, check_audio_data, + _get_audio_parameters, _array_to_bytes, _mix_audio_channels, _extract_selected_channel, @@ -428,6 +429,18 @@ self.assertEqual(audio_source.channels, 1) @genty_dataset( + missing_sampling_rate=("sr",), + missing_sample_width=("sw",), + missing_channels=("ch",), + ) + def test_load_raw_missing_audio_param(self, missing_param): + with self.assertRaises(AudioParameterError): + params = AUDIO_PARAMS_SHORT.copy() + del params[missing_param] + srate, swidth, channels, _ = _get_audio_parameters(params) + _load_raw("audio", srate, swidth, channels) + + @genty_dataset( mono=("mono_400Hz.wav", (400,)), three_channel=("3channel_400-800-1600Hz.wav", (400, 800, 1600)), )