Added fast tests.

This commit is contained in:
The Wobbler 2025-03-18 17:31:25 +01:00
parent 8554ef8d81
commit d48394a522
3 changed files with 45 additions and 20 deletions

View file

@ -27,12 +27,6 @@ class _ID3(SmallTag, tinytag._ID3):
def write(self, file_obj: BinaryIO=None):
should_close_file = self._set_filehandler_for_writing(file_obj)
# change keys to values in the mapping dict
self._ID3_WRITE_MAPPING = {} # noqa
for frame_id, name in self._ID3_MAPPING.items():
if len(frame_id) == 4:
self._ID3_WRITE_MAPPING[name] = frame_id
new_tag = self._compose_id3v2_tag()
size, extended, major = self._parse_id3v2_header(self._filehandler)
@ -48,6 +42,12 @@ class _ID3(SmallTag, tinytag._ID3):
self._filehandler.close()
def _compose_id3v2_tag(self) -> bytes:
# change keys to values in the mapping dict
self._ID3_WRITE_MAPPING = {} # noqa
for frame_id, name in self._ID3_MAPPING.items():
if len(frame_id) == 4:
self._ID3_WRITE_MAPPING[name] = frame_id
frames = self._compose_id3v2_frames()
frame_size = len(frames)