kopia lustrzana https://github.com/corrscope/corrscope
Improve error messages for 24-bit WAV files (#443)
rodzic
e6347dfe39
commit
cb215cdb1c
|
@ -482,8 +482,7 @@ def _read_data_chunk(fid, format_tag, channels, bit_depth, is_big_endian,
|
|||
shape=(n_samples,))
|
||||
fid.seek(start + size)
|
||||
else:
|
||||
raise ValueError("mmap=True not compatible with "
|
||||
f"{bytes_per_sample}-byte container size.")
|
||||
raise ValueError(f"{bytes_per_sample * 8}-bit WAV is not supported.")
|
||||
|
||||
_handle_pad_byte(fid, size)
|
||||
|
||||
|
|
|
@ -50,6 +50,20 @@ def test_incomplete_wav_chunk():
|
|||
data = wave[:]
|
||||
|
||||
|
||||
def test_24_bit_wav():
|
||||
"""Tests that WAV files exported from foobar2000 can be loaded properly,
|
||||
without a `ValueError: Incomplete wav chunk.` exception being raised."""
|
||||
|
||||
try:
|
||||
wave = Wave(prefix + "s24-impulse1000.wav")
|
||||
except ValueError as e:
|
||||
assert e.args == (f"24-bit WAV is not supported.",)
|
||||
except Exception as e:
|
||||
pytest.fail(f"Unexpected exception {e}")
|
||||
else:
|
||||
pytest.fail(f"Expected exception loading 24-bit wav, none found")
|
||||
|
||||
|
||||
# Stereo tests
|
||||
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue