def METHOD_NAME(
    self, metadata_update, mock_upload_file, mock_upload, mock_download, mock_create
):
    with tempfile.TemporaryDirectory() as tmpdirname:
        io = gr.Interface(
            lambda x: x,
            "text",
            "text",
            flagging_dir=tmpdirname,
            flagging_callback=flagging.HuggingFaceDatasetSaver("test", "test"),
        )
        row_count = io.flagging_callback.flag(["test", "test"], "")
        assert row_count == 1  # 2 rows written including header
        row_count = io.flagging_callback.flag(["test", "test"])
        assert row_count == 2  # 3 rows written including header
        for _, _, filenames in os.walk(tmpdirname):
            for f in filenames:
                fname = os.path.basename(f)
                assert fname in ["data.csv", "dataset_info.json"] or fname.endswith(
                    ".lock"
                )