changeset 135:4d290493f590

Effectively call to_file in test_to_file_raw and test_to_file_wave
author Amine Sehili <amine.sehili@gmail.com>
date Mon, 11 Feb 2019 20:28:51 +0100
parents 0125bd4ee317
children 03062069b491
files tests/test_io.py
diffstat 1 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test_io.py	Mon Feb 11 20:19:46 2019 +0100
+++ b/tests/test_io.py	Mon Feb 11 20:28:51 2019 +0100
@@ -22,6 +22,7 @@
     from_file,
     _save_raw,
     _save_wave,
+    to_file,
 )
 
 
@@ -577,7 +578,7 @@
         tmpdir = TemporaryDirectory()
         filename = os.path.join(tmpdir.name, filename)
         data = _array_to_bytes(PURE_TONE_DICT[400])
-        _save_raw(filename, data)
+        to_file(data, filename, audio_format=audio_format)
         self.assertTrue(filecmp.cmp(filename, exp_filename, shallow=False))
         tmpdir.cleanup()
 
@@ -589,13 +590,18 @@
         wave_with_extension=("audio.wave", None),
         wave_with_audio_format_and_extension=("audio.mp3", "wave"),
     )
-    def test_to_file_wav(self, filename, audio_format):
+    def test_to_file_wave(self, filename, audio_format):
         exp_filename = "tests/data/test_16KHZ_mono_400Hz.wav"
         tmpdir = TemporaryDirectory()
         filename = os.path.join(tmpdir.name, filename)
         data = _array_to_bytes(PURE_TONE_DICT[400])
-        _save_wave(
-            filename, data, sampling_rate=16000, sample_width=2, channels=1
+        to_file(
+            data,
+            filename,
+            audio_format=audio_format,
+            sampling_rate=16000,
+            sample_width=2,
+            channels=1,
         )
         self.assertTrue(filecmp.cmp(filename, exp_filename, shallow=False))
         tmpdir.cleanup()