|
@@ -9,12 +9,12 @@ from symuid._tag_interface import ID3
|
|
|
|
|
|
@pytest.fixture
|
|
@pytest.fixture
|
|
def empty_id3_iface(tmpdir, tracks_dir_path):
|
|
def empty_id3_iface(tmpdir, tracks_dir_path):
|
|
- p = tmpdir.join('empty.mp3').strpath
|
|
|
|
|
|
+ path = tmpdir.join('empty.mp3').strpath
|
|
shutil.copyfile(
|
|
shutil.copyfile(
|
|
src=os.path.join(tracks_dir_path, 'id3v2.4-empty.mp3'),
|
|
src=os.path.join(tracks_dir_path, 'id3v2.4-empty.mp3'),
|
|
- dst=p,
|
|
|
|
|
|
+ dst=path,
|
|
)
|
|
)
|
|
- return ID3(mutagen.File(p))
|
|
|
|
|
|
+ return ID3(mutagen.File(path))
|
|
|
|
|
|
|
|
|
|
@pytest.mark.parametrize('track_name', ['id3v2.4-empty.mp3'])
|
|
@pytest.mark.parametrize('track_name', ['id3v2.4-empty.mp3'])
|
|
@@ -45,11 +45,11 @@ def test_get_comment(tracks_dir_path, track_name, expected_comment):
|
|
|
|
|
|
|
|
|
|
def test_set_comment(empty_id3_iface):
|
|
def test_set_comment(empty_id3_iface):
|
|
- assert None == empty_id3_iface.get_comment()
|
|
|
|
|
|
+ assert empty_id3_iface.get_comment() is None
|
|
empty_id3_iface.set_comment('latin')
|
|
empty_id3_iface.set_comment('latin')
|
|
- assert 'latin' == empty_id3_iface.get_comment()
|
|
|
|
|
|
+ assert empty_id3_iface.get_comment() == 'latin'
|
|
empty_id3_iface.set_comment('你好')
|
|
empty_id3_iface.set_comment('你好')
|
|
- assert '你好' == empty_id3_iface.get_comment()
|
|
|
|
|
|
+ assert empty_id3_iface.get_comment() == '你好'
|
|
empty_id3_iface.save()
|
|
empty_id3_iface.save()
|
|
tags = mutagen.File(empty_id3_iface.track_path).tags
|
|
tags = mutagen.File(empty_id3_iface.track_path).tags
|
|
assert len(tags) == 1
|
|
assert len(tags) == 1
|