def rename_track(track, pattern): supported_fields = track.supported_fields() fields = {field: getattr(track, field) for field in supported_fields} name = pattern.format(**fields) + extension(track.path) destination = os.path.join(parent(track.path), name) shutil.move(track.path, destination) track.path = destination
def test_extension(): assert library.extension(path_file) == '.ext'