changeset 121:dcf8a245ba1b

Add test for from_file when pydub is not installed
author Amine Sehili <amine.sehili@gmail.com>
date Sat, 02 Feb 2019 14:22:02 +0100
parents 9b117eb6ecfd
children 3728814e1233
files tests/test_io.py
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test_io.py	Sat Feb 02 13:07:28 2019 +0100
+++ b/tests/test_io.py	Sat Feb 02 14:22:02 2019 +0100
@@ -7,6 +7,7 @@
 from unittest import TestCase
 from genty import genty, genty_dataset
 from auditok.io import (
+    AudioIOError,
     DATA_FORMAT,
     AudioParameterError,
     check_audio_data,
@@ -209,6 +210,11 @@
         _save_raw(tmpfile.name, data)
         self.assertTrue(filecmp.cmp(tmpfile.name, filename, shallow=False))
 
+    def test_from_file_no_pydub(self):
+        with patch("auditok.io._WITH_PYDUB", False):
+            with self.assertRaises(AudioIOError):
+                from_file("audio", "mp3")
+
     @genty_dataset(
         mono=("mono_400Hz.wav", (400,)),
         three_channel=("3channel_400-800-1600Hz.wav", (400, 800, 1600)),