Skip to content

Commit

Permalink
Make sure the error ID3NoHeaderError is raised for test file
Browse files Browse the repository at this point in the history
  • Loading branch information
chazeon committed May 29, 2024
1 parent 0016ff2 commit 7636e81
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tests/2/test_id3_tagging_with_missing_id3.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from pathlib import Path
import shutil
import mutagen
import pytest

TESTS_DIR = Path(__file__).parent.parent
sys.path.insert(0, str(TESTS_DIR.parent))
Expand All @@ -18,13 +19,21 @@

def test_id3_tagging_with_missing_id3(tmpdir):


test_mp3 = tmpdir / "id3_removed.mp3"

shutil.copyfile(
CURR_TEST_DIR / "data" / "id3_removed.mp3",
test_mp3
)


from mutagen.id3 import ID3NoHeaderError
from mutagen.easyid3 import EasyID3

with pytest.raises(ID3NoHeaderError):
mutagen.easyid3.EasyID3(test_mp3)

Visitor.retag(
test_mp3,
article_info={
Expand All @@ -39,7 +48,6 @@ def test_id3_tagging_with_missing_id3(tmpdir):
catalog_info={}
)

from mutagen.easyid3 import EasyID3
tag = EasyID3(test_mp3)

assert tag["title"] == ["测试标题"]
Expand Down

0 comments on commit 7636e81

Please sign in to comment.