# HG changeset patch # User Amine Sehili # Date 1550258826 -3600 # Node ID 95203e47e278715b33ecc4fce86169eee0642cd2 # Parent 2474e1e185433182e02713acefca2d4748b5f815 Add test for to_file with missing audio parameters diff -r 2474e1e18543 -r 95203e47e278 tests/test_io.py --- a/tests/test_io.py Thu Feb 14 21:05:49 2019 +0100 +++ b/tests/test_io.py Fri Feb 15 20:27:06 2019 +0100 @@ -616,3 +616,16 @@ ) self.assertTrue(filecmp.cmp(filename, exp_filename, shallow=False)) tmpdir.cleanup() + + @genty_dataset( + missing_sampling_rate=("sr",), + missing_sample_width=("sw",), + missing_channels=("ch",), + ) + def test_to_file_missing_audio_param(self, missing_param): + params = AUDIO_PARAMS_SHORT.copy() + del params[missing_param] + with self.assertRaises(AudioParameterError): + to_file(b"\0\0", "audio", audio_format="wav", **params) + with self.assertRaises(AudioParameterError): + to_file(b"\0\0", "audio", audio_format="mp3", **params)