Skip to content

Commit

Permalink
Add ID3v2 test files without unsynchronization
Browse files Browse the repository at this point in the history
  • Loading branch information
thebigmunch committed Feb 26, 2020
1 parent 3af864f commit 3da786b
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 2 deletions.
Binary file added tests/files/audio/test-mp3-id3v23-unsync.mp3
Binary file not shown.
Binary file modified tests/files/audio/test-mp3-id3v23.mp3
Binary file not shown.
Binary file added tests/files/audio/test-mp3-id3v24-unsync.mp3
Binary file not shown.
Binary file modified tests/files/audio/test-mp3-id3v24.mp3
Binary file not shown.
18 changes: 16 additions & 2 deletions tests/test_formats_id3v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,20 @@ def test_ID3v2Flags():

def test_ID3v2Header():
v24_header_load = ID3v2Header.load(Path(__file__).parent / 'files' / 'audio' / 'test-mp3-id3v24.mp3')
v24_header_init = ID3v2Header(
size=2254,
flags=ID3v2Flags(
experimental=False,
extended=False,
footer=False,
unsync=False,
),
version=ID3Version.v24,
)

assert v24_header_load == v24_header_init

v24_header_load = ID3v2Header.load(Path(__file__).parent / 'files' / 'audio' / 'test-mp3-id3v24-unsync.mp3')
v24_header_init = ID3v2Header(
size=2254,
flags=ID3v2Flags(
Expand All @@ -113,9 +127,9 @@ def test_ID3v2Header():
version=ID3Version.v24,
)

assert v24_header_load == v24_header_init

with pytest.raises(InvalidHeader):
ID3v2Header.load(
(Path(__file__).parent / 'files' / 'audio' / 'test-mp3-id3v24.mp3').read_bytes()[3:]
)

assert v24_header_load == v24_header_init

0 comments on commit 3da786b

Please sign in to comment.