changeset 162:ee883f8c372b

Add tests for from_file with large_file=True
author Amine Sehili <amine.sehili@gmail.com>
date Sat, 02 Mar 2019 15:01:05 +0100
parents e91d97f7a632
children 3ddaa5eda8d4
files tests/test_io.py
diffstat 1 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test_io.py	Thu Feb 28 20:48:10 2019 +0100
+++ b/tests/test_io.py	Sat Mar 02 15:01:05 2019 +0100
@@ -12,6 +12,8 @@
     AudioIOError,
     AudioParameterError,
     BufferAudioSource,
+    RawAudioSource,
+    WaveAudioSource,
     check_audio_data,
     _guess_audio_format,
     _normalize_use_channel,
@@ -269,6 +271,19 @@
             from_file(filename, audio_format, **kwargs)
         self.assertTrue(patch_function.called)
 
+    def test_from_file_large_file_raw(self, ):
+        filename = "tests/data/test_16KHZ_mono_400Hz.raw"
+        audio_source = from_file(filename, large_file=True,
+                                 sampling_rate=16000,
+                                 sample_width=2,
+                                 channels=1)
+        self.assertIsInstance(audio_source, RawAudioSource)
+
+    def test_from_file_large_file_wave(self, ):
+        filename = "tests/data/test_16KHZ_mono_400Hz.wav"
+        audio_source = from_file(filename, large_file=True)
+        self.assertIsInstance(audio_source, WaveAudioSource)
+
     @genty_dataset(
         missing_sampling_rate=("sr",),
         missing_sample_width=("sw",),