code: def test_migrate_domain_raises_when_output_location_is_used(
      tmp_path: Path, migrate_file_only: bool, default_location: bool
  ):
      domain_dir = tmp_path / "domain"
      domain_file_name = "domain.yml"
      domain_dir.mkdir()
      prepare_domain_path(
          domain_dir,
          """
          version: "2.0"
          intents: []
          """,
          domain_file_name,
      )
  
      if not migrate_file_only:
          domain_path = domain_dir
          if default_location:
              out_path = None
              non_empty_existing_dir = (
                  tmp_path / migrate.DEFAULT_NEW_DOMAIN
              )
          else:
              out_path = tmp_path / "my_custom_new_domain_name"
              non_empty_existing_dir = out_path
          non_empty_existing_dir.mkdir()
          # in contrast to the backup location, the output directory may exist
          # but must be empty
          with open(non_empty_existing_dir / "bla.txt", "w"):
              pass
  
      else:
          domain_path = domain_dir / domain_file_name
          if default_location:
              out_path = None
              existing_file = tmp_path / (
                  migrate.DEFAULT_NEW_DOMAIN + migrate.YML_SUFFIX
              )
          else:
              out_path = tmp_path / "my_custom_file_name.yml"
              existing_file = out_path
          with open(existing_file, "w"):
              pass
  
      with pytest.raises(
          RasaException,
          match="The domain could not be migrated to .* because .* already exists.*",
      ):
          migrate.migrate_domain_format(domain_path, out_path)
  
imports: import itertools
  import shutil
  import re
  import textwrap
  from pathlib import Path
  from typing import Text, Any, Tuple, Callable
  from unittest.mock import patch, call
  import pytest
  import rasa.shared.utils.io
  from rasa.core import migrate
  from rasa.shared.core.domain import Domain
  from rasa.shared.exceptions import RasaException
  from rasa.shared.constants import LATEST_TRAINING_DATA_FORMAT_VERSION
label_desc: Use image node_id 23 for calling a global function with example usage: test_migrate_domain_raises_when_output_location_is_used(tmp_path, migrate_file_only, default_location) without return types