changeset 137:2474e1e18543

Add test for from_file with missing audio parameters
author Amine Sehili <amine.sehili@gmail.com>
date Thu, 14 Feb 2019 21:05:49 +0100
parents 03062069b491
children 95203e47e278
files tests/test_io.py
diffstat 1 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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):