diff --git a/tests/formats/test.mp3 b/tests/formats/test.mp3 deleted file mode 100644 index 41fb2a9..0000000 Binary files a/tests/formats/test.mp3 and /dev/null differ diff --git a/tests/formats/test_id3.py b/tests/formats/test_id3.py deleted file mode 100644 index 205e8a5..0000000 --- a/tests/formats/test_id3.py +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/python3 - -import pytest -from io import BytesIO - -from smalltag import SmallTag - - -def test_written_gets_recognized(): - # avoid writing to the real file by using a BytesIO - tag = SmallTag.get("formats/test.mp3", file_obj=BytesIO(b"")) - - tag.title = "A normal title." - tag.artist = "An artist." - tag.album = "The album." - tag.track = 1234 - tag.other["url"] = ["https://teapot.informationsanarchistik.de/Wobbl/SmallTag"] - - tag = SmallTag.get("formats/test.mp3", file_obj=BytesIO(tag.compose_tag())) - - assert tag.title == "A normal title." - assert tag.artist == "An artist." - assert tag.album == "The album." - assert tag.track == 1234 - assert tag.other["url"] == ["https://teapot.informationsanarchistik.de/Wobbl/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 _-" - - -@pytest.mark.slow -def test_full_written_gets_recognized(): - 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.track = 1234 - tag.other["url"] = ["https://teapot.informationsanarchistik.de/Wobbl/SmallTag"] - - tag.write() - - tag = SmallTag.get("formats/test.mp3") - - assert tag.title == field_content - assert tag.artist == field_content - assert tag.album == field_content - assert tag.track == 1234 - assert tag.other["url"] == ["https://teapot.informationsanarchistik.de/Wobbl/SmallTag"] diff --git a/tests/test_all_formats.py b/tests/test_all_formats.py new file mode 100644 index 0000000..a565f33 --- /dev/null +++ b/tests/test_all_formats.py @@ -0,0 +1,37 @@ +#!/usr/bin/python3 + +import pytest + +from smalltag import SmallTag + + +to_test = [ + ".mp1", ".mp2", ".mp3", + ".oga", ".ogg", ".opus", ".spx", + ".wav", + ".flac", + ".wma", + ".m4b", ".m4a", ".m4r", ".m4v", ".mp4", ".aax", ".aaxc", + ".aiff", ".aifc", ".aif", ".afc" +] + + +@pytest.mark.parametrize("file_type", to_test) +def test_writing_working(file_type: str): + tag = SmallTag.get("test_files/test" + file_type) + + tag.title = "A normal title." + tag.artist = "An artist." + tag.album = "The album." + tag.track = 4321 + tag.other["url"] = ["https://teapot.informationsanarchistik.de/Wobbl/SmallTag"] + + tag.write() + + tag = SmallTag.get("test_files/test" + file_type) + + assert tag.title == "A normal title." + assert tag.artist == "An artist." + assert tag.album == "The album." + assert tag.track == 4321 + assert tag.other["url"] == ["https://teapot.informationsanarchistik.de/Wobbl/SmallTag"] diff --git a/tests/test_files/test.flac b/tests/test_files/test.flac new file mode 100644 index 0000000..e463d82 Binary files /dev/null and b/tests/test_files/test.flac differ diff --git a/tests/test_files/test.m4a b/tests/test_files/test.m4a new file mode 100644 index 0000000..a4cccaf Binary files /dev/null and b/tests/test_files/test.m4a differ diff --git a/tests/test_files/test.mp2 b/tests/test_files/test.mp2 new file mode 100644 index 0000000..6caca35 Binary files /dev/null and b/tests/test_files/test.mp2 differ diff --git a/tests/test_files/test.mp3 b/tests/test_files/test.mp3 new file mode 100644 index 0000000..9f83450 Binary files /dev/null and b/tests/test_files/test.mp3 differ diff --git a/tests/test_files/test.ogg b/tests/test_files/test.ogg new file mode 100644 index 0000000..0d9fdc3 Binary files /dev/null and b/tests/test_files/test.ogg differ diff --git a/tests/test_files/test.opus b/tests/test_files/test.opus new file mode 100644 index 0000000..3d7e810 Binary files /dev/null and b/tests/test_files/test.opus differ diff --git a/tests/test_files/test.wav b/tests/test_files/test.wav new file mode 100644 index 0000000..2b7ded7 Binary files /dev/null and b/tests/test_files/test.wav differ diff --git a/tests/test_files/test.wma b/tests/test_files/test.wma new file mode 100644 index 0000000..5ecc6a3 Binary files /dev/null and b/tests/test_files/test.wma differ