changeset 138:95203e47e278

Add test for to_file with missing audio parameters
author Amine Sehili <amine.sehili@gmail.com>
date Fri, 15 Feb 2019 20:27:06 +0100
parents 2474e1e18543
children 01ef241d17e6
files tests/test_io.py
diffstat 1 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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)