Browse Source

test symuid.tag_interface.ID3._get_single_text

Fabian Peter Hammerle 5 years ago
parent
commit
6104e13ebc
2 changed files with 26 additions and 0 deletions
  1. 8 0
      tests/conftest.py
  2. 18 0
      tests/tag_interface/id3.py

+ 8 - 0
tests/conftest.py

@@ -0,0 +1,8 @@
+import pytest
+
+import os
+
+
+@pytest.fixture
+def tracks_dir_path():
+    return os.path.join(os.path.dirname(__file__), 'tracks')

+ 18 - 0
tests/tag_interface/id3.py

@@ -0,0 +1,18 @@
+import pytest
+
+from symuid.tag_interface import ID3
+
+import mutagen
+import os
+import shutil
+
+
+@pytest.mark.parametrize(('track_name', 'tag_label', 'expected_text'), [
+    ('id3v2.4-empty.mp3', 'TPE1', None),
+    ('id3v2.4-typical.mp3', 'TPE1', 'some artist'),
+    ('id3v2.4-typical.mp3', 'COMM::eng', 'some comment'),
+    ('id3v2.4-typical.mp3', 'COMM', None),
+])
+def test__get_single_text(tracks_dir_path, track_name, tag_label, expected_text):
+    iface = ID3(mutagen.File(os.path.join(tracks_dir_path, track_name)))
+    assert expected_text == iface._get_single_text(tag_label)