code: def test_upload_file_with_revision_mock(
      self,
      create_mock: Mock,
      upload_mock: Mock,
      repo_info_mock: Mock,
      create_branch_mock: Mock,
  ) -> None:
      repo_info_mock.side_effect = RevisionNotFoundError(
          "revision not found"
      )
  
      with SoftTemporaryDirectory() as cache_dir:
          file_path = Path(cache_dir) / "file.txt"
          file_path.write_text("content")
          cmd = UploadCommand(
              self.parser.parse_args(
                  [
                      "upload",
                      "my-model",
                      str(file_path),
                      "logs/file.txt",
                      "--revision",
                      "my-branch",
                  ]
              )
          )
          cmd.run()
  
          # Revision specified => check that it exists
          repo_info_mock.assert_called_once_with(
              repo_id=create_mock.return_value.repo_id,
              repo_type="model",
              revision="my-branch",
          )
  
          # Revision does not exist => create it
          create_branch_mock.assert_called_once_with(
              repo_id=create_mock.return_value.repo_id,
              repo_type="model",
              branch="my-branch",
              exist_ok=True,
          )
  
imports: import os
  import unittest
  import warnings
  from argparse import ArgumentParser, Namespace
  from contextlib import contextmanager
  from pathlib import Path
  from typing import Generator
  from unittest.mock import Mock, patch
  from huggingface_hub.commands.delete_cache import DeleteCacheCommand
  from huggingface_hub.commands.download import DownloadCommand
  from huggingface_hub.commands.scan_cache import ScanCacheCommand
  from huggingface_hub.commands.upload import UploadCommand
  from huggingface_hub.utils import RevisionNotFoundError, SoftTemporaryDirectory, capture_output
  from .testing_utils import DUMMY_MODEL_ID
label_desc: Use image node_id 17 for calling the TestUploadCommand obj's underlying member method code with example usage: obj.test_upload_file_with_revision_mock(create_mock, upload_mock, repo_info_mock, create_branch_mock) without return types