code: def test_train_data_in_project_dir(
      monkeypatch: MonkeyPatch, tmp_path: Path
  ):
      """Test cache directory placement.
  
      Tests cache directories for training data are in project root, not
      where `rasa init` is run.
      """
      # We would like to test CLI but can't run it with popen because we want
      # to be able to monkeypatch it. Solution is to call functions inside CLI
      # module. Initial project folder should have been created before
      # `init_project`, that's what we do here.
      monkeypatch.chdir(tmp_path)
      new_project_folder_path = tmp_path / "new-project-folder"
      new_project_folder_path.mkdir()
  
      # Simulate CLI run arguments.
      parser = argparse.ArgumentParser()
      subparsers = parser.add_subparsers()
      scaffold.add_subparser(subparsers, parents=[])
  
      args = parser.parse_args(["init", "--no-prompt"])
  
      # Simple config which should train fast.
      def mock_get_config(*args):
          return {
              "language": "en",
              "pipeline": [{"name": "KeywordIntentClassifier"}],
              "policies": [{"name": "RulePolicy"}],
              "recipe": "default.v1",
          }
  
      monkeypatch.setattr(
          "rasa.shared.importers.importer.CombinedDataImporter.get_config",
          mock_get_config,
      )
      # Cache dir is auto patched to be a temp directory, this makes it
      # go back to local project folder so we can test it is created correctly.
      with enable_cache(Path(".rasa", "cache")):
          mock_stdin([])
          scaffold.init_project(args, str(new_project_folder_path))
      assert os.getcwd() == str(new_project_folder_path)
      assert os.path.exists(".rasa/cache")
  
file_path: rasa/tests/cli/test_rasa_init.py
imports: import argparse
  import os
  from pathlib import Path
  from typing import Callable
  from _pytest.pytester import RunResult
  from _pytest.monkeypatch import MonkeyPatch
  from rasa.cli import scaffold
  from tests.conftest import enable_cache
  from tests.core.channels.test_cmdline import mock_stdin
  from tests.cli.conftest import RASA_EXE
label_desc: Use image node_id 5 for calling a global function with example usage: test_train_data_in_project_dir(monkeypatch, tmp_path) and returns: dict