test_mp4.py 624 B

1234567891011121314151617181920
  1. import mutagen
  2. from symuid._tag_interface import MP4
  3. # pylint: disable=protected-access
  4. def test_set_comment(empty_mp4_path):
  5. iface = MP4(mutagen.File(empty_mp4_path))
  6. assert iface.get_comment() is None
  7. iface.set_comment('latin')
  8. assert iface.get_comment() == 'latin'
  9. iface.set_comment('mp4 你好')
  10. assert iface.get_comment() == 'mp4 你好'
  11. iface.save()
  12. iface_reread = MP4(mutagen.File(empty_mp4_path))
  13. assert iface_reread.get_comment() == 'mp4 你好'
  14. tags = mutagen.File(iface.track_path).tags
  15. assert len(tags) == 1
  16. assert tags.items()[0] == ('©cmt', ['mp4 你好'])