# HG changeset patch # User Amine Sehili # Date 1570278363 -7200 # Node ID 69ca1c64a9b01f0dd09dbd5305dcd4801986cd77 # Parent 41a93cc1ced93d0dc2163d73bd71ae57bcde374f Return 'wav' when 'wave' is guessed in _guess_audio_format diff -r 41a93cc1ced9 -r 69ca1c64a9b0 auditok/io.py --- a/auditok/io.py Fri Oct 04 22:02:37 2019 +0100 +++ b/auditok/io.py Sat Oct 05 14:26:03 2019 +0200 @@ -95,8 +95,14 @@ def _guess_audio_format(fmt, filename): if fmt is None: extension = os.path.splitext(filename.lower())[1][1:] - return extension if extension else None - return fmt.lower() + if extension: + fmt = extension + else: + return None + fmt == fmt.lower() + if fmt == "wave": + fmt = "wav" + return fmt def _normalize_use_channel(use_channel): diff -r 41a93cc1ced9 -r 69ca1c64a9b0 tests/test_io.py --- a/tests/test_io.py Fri Oct 04 22:02:37 2019 +0100 +++ b/tests/test_io.py Sat Oct 05 14:26:03 2019 +0200 @@ -67,6 +67,8 @@ extention_no_format=(None, "filename.wav", "wav"), format_no_extension=("wav", "filename", "wav"), no_format_no_extension=(None, "filename", None), + wave_as_wav=("wave", "filename", "wav"), + wave_as_wav_extension=(None, "filename.wave", "wav"), ) def test_guess_audio_format(self, fmt, filename, expected): result = _guess_audio_format(fmt, filename)