code: def test_save_model_card_history_removal(self):
      model = self.model_init()
      model = self.model_fit(model)
  
      history_path = self.cache_dir / "history.json"
      history_path.write_text("Keras FTW")
  
      with pytest.warns(
          UserWarning, match="`history.json` file already exists, *"
      ):
          save_pretrained_keras(model, save_directory=self.cache_dir)
          # assert that it's not the same as old history file and it's overridden
          self.assertNotEqual("Keras FTW", history_path.read_text())
  
          # Check the history is saved as a json in the repository.
          files = os.listdir(self.cache_dir)
          self.assertIn("history.json", files)
  
          # Check that there is no "Training Metrics" section in the model card.
          # This was done in an older version.
          self.assertNotIn(
              "Training Metrics",
              (self.cache_dir / "README.md").read_text(),
          )
  
imports: import json
  import os
  import unittest
  from pathlib import Path
  import pytest
  from huggingface_hub import HfApi, hf_hub_download, snapshot_download
  from huggingface_hub.keras_mixin import KerasModelHubMixin, from_pretrained_keras, push_to_hub_keras, save_pretrained_keras
  from huggingface_hub.utils import is_graphviz_available, is_pydot_available, is_tf_available, logging
  from .testing_constants import ENDPOINT_STAGING, TOKEN, USER
  from .testing_utils import repo_name
label_desc: Use image node_id 5 for calling the HubKerasSequentialTest obj's underlying member method code with example usage: obj.test_save_model_card_history_removal() without return types