Added tests and did improved class and file structure.

This commit is contained in:
The Wobbler 2025-03-15 17:52:41 +01:00
parent c6df2441f8
commit dfa9ab6529
6 changed files with 87 additions and 39 deletions

BIN
tests/formats/test.mp3 Normal file

Binary file not shown.

30
tests/formats/test_id3.py Normal file
View file

@ -0,0 +1,30 @@
#!/usr/bin/python3
from smalltag import SmallTag
# chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_ "
# no "b" because there is a bug in TinyTag 2.1.0 that removes "b"s if they are at the beginning of a string
chars = "acdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789- _"
def test_writing_text_frames():
for char1 in chars:
for char2 in chars:
field_content = f"{char1}{char2}Test{char2}{char1}"
tag = SmallTag.get("formats/test.mp3")
tag.title = field_content
tag.artist = field_content
tag.album = field_content
tag.write()
tag = SmallTag.get("formats/test.mp3")
assert tag.title == field_content
assert tag.artist == field_content
assert tag.album == field_content