code: def test_save_pretrained_with_push_to_hub(model, tmp_path):
      save_directory = f"{str(tmp_path / REPO_NAME)}"
  
      model.push_to_hub = Mock()
      model.construct_model_card = Mock()
      model._save_pretrained = (
          Mock()
      )  # disable _save_pretrained to speed-up
  
      # Not pushed to hub
      model.save_pretrained(save_directory)
      model.push_to_hub.assert_not_called()
      model.construct_model_card.assert_called_with(
          MODEL_NAME, DATASET_NAME
      )
  
      # Push to hub with repo_id
      model.save_pretrained(
          save_directory,
          push_to_hub=True,
          repo_id="CustomID",
          config=CONFIG,
      )
      model.push_to_hub.assert_called_with(
          repo_id="CustomID", config=CONFIG
      )
  
      # Push to hub with default repo_id (based on dir name)
      model.save_pretrained(
          save_directory, push_to_hub=True, config=CONFIG
      )
      model.push_to_hub.assert_called_with(
          repo_id=REPO_NAME, config=CONFIG
      )
  
file_path: pytorch_geometric/test/nn/test_model_hub.py
imports: import os
  from pathlib import Path
  from unittest.mock import Mock
  import pytest
  import torch
  from torch_geometric.nn import GCN
  from torch_geometric.nn.model_hub import PyGModelHubMixin
  from torch_geometric.testing import withPackage
label_desc: Use image node_id 5 for calling a global function with example usage: test_save_pretrained_with_push_to_hub(model, tmp_path) without return types