# HG changeset patch # User Amine Sehili # Date 1550174749 -3600 # Node ID 2474e1e185433182e02713acefca2d4748b5f815 # Parent 03062069b491ccb91363d4406c8a75550ea0b23c Add test for from_file with missing audio parameters diff -r 03062069b491 -r 2474e1e18543 tests/test_io.py --- a/tests/test_io.py Wed Feb 13 20:09:38 2019 +0100 +++ b/tests/test_io.py Thu Feb 14 21:05:49 2019 +0100 @@ -202,6 +202,17 @@ from_file(filename, audio_format, **kwargs) self.assertTrue(patch_function.called) + @genty_dataset( + missing_sampling_rate=("sr",), + missing_sample_width=("sw",), + missing_channels=("ch",), + ) + def test_from_file_missing_audio_param(self, missing_param): + with self.assertRaises(AudioParameterError): + params = AUDIO_PARAMS_SHORT.copy() + del params[missing_param] + from_file("audio", audio_format="raw", **params) + def test_from_file_no_pydub(self): with patch("auditok.io._WITH_PYDUB", False): with self.assertRaises(AudioIOError):