|
@@ -13,3 +13,27 @@ def test_get_track_path(tracks_dir_path, track_name):
|
|
|
track_path = os.path.join(tracks_dir_path, track_name)
|
|
|
iface = OggOpus(mutagen.File(track_path))
|
|
|
assert track_path == iface.track_path
|
|
|
+
|
|
|
+
|
|
|
+@pytest.mark.parametrize(('track_name', 'expected_comment'), [
|
|
|
+ ('ogg-opus-empty.opus', None),
|
|
|
+ ('ogg-opus-typical.opus', 'some comment'),
|
|
|
+])
|
|
|
+def test_get_comment(tracks_dir_path, track_name, expected_comment):
|
|
|
+ iface = OggOpus(mutagen.File(os.path.join(tracks_dir_path, track_name)))
|
|
|
+ assert expected_comment == iface.get_comment()
|
|
|
+
|
|
|
+
|
|
|
+def test_set_comment(empty_ogg_opus_path):
|
|
|
+ iface = OggOpus(mutagen.File(empty_ogg_opus_path))
|
|
|
+ assert iface.get_comment() is None
|
|
|
+ iface.set_comment('latin')
|
|
|
+ assert iface.get_comment() == 'latin'
|
|
|
+ iface.set_comment('你好')
|
|
|
+ assert iface.get_comment() == '你好'
|
|
|
+ iface.save()
|
|
|
+ iface_reread = OggOpus(mutagen.File(empty_ogg_opus_path))
|
|
|
+ assert iface_reread.get_comment() == '你好'
|
|
|
+ tags = mutagen.File(iface.track_path).tags
|
|
|
+ assert len(tags) == 1
|
|
|
+ assert tags.items()[0] == ('comment', ['你好'])
|