From edb91e4719d07b7d972fe22f51f0be4c18d73e24 Mon Sep 17 00:00:00 2001 From: Hagen Wierstorf Date: Fri, 27 Jan 2023 11:19:38 +0100 Subject: [PATCH] TST: add test for out-of-bounds offset in read() --- tests/test_audiofile.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/test_audiofile.py b/tests/test_audiofile.py index a95ad16e..c9c91318 100644 --- a/tests/test_audiofile.py +++ b/tests/test_audiofile.py @@ -492,6 +492,15 @@ def test_mp3(tmpdir, magnitude, sampling_rate, channels): atol=tolerance('duration', sampling_rate), ) + # Test out-of-bounds offset argument, + # see https://github.com/audeering/audiofile/issues/88 + offset = 2.0 + sig, fs = af.read(mp3_file, offset=offset, always_2d=True) + np.testing.assert_array_equal( + sig, + np.zeros((channels, 0), dtype='float32'), + ) + def test_formats(): files = [