Added tests and did improved class and file structure.
This commit is contained in:
parent
c6df2441f8
commit
dfa9ab6529
6 changed files with 87 additions and 39 deletions
BIN
tests/formats/test.mp3
Normal file
BIN
tests/formats/test.mp3
Normal file
Binary file not shown.
30
tests/formats/test_id3.py
Normal file
30
tests/formats/test_id3.py
Normal 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
|
||||
|
17
tests/id3.py
17
tests/id3.py
|
@ -1,17 +0,0 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
from json import dumps
|
||||
from smalltag import SmallTag
|
||||
|
||||
|
||||
test_tag = SmallTag.get("test.mp3")
|
||||
print(test_tag)
|
||||
|
||||
print(test_tag.title)
|
||||
test_tag.title = "bTest"
|
||||
|
||||
test_tag.write()
|
||||
|
||||
test_tag = SmallTag.get("test.mp3")
|
||||
|
||||
print(dumps(test_tag.as_dict(), indent=" "))
|
BIN
tests/test.mp3
BIN
tests/test.mp3
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue