code: def test_path_in_tree_limited_to_config_dir(tmpdir):
      root_nb_dir = tmpdir.mkdir("notebooks")
      nb_dir = root_nb_dir.mkdir("notebooks")
      src_dir = root_nb_dir.mkdir("scripts")
      other_dir = root_nb_dir.mkdir("other")
  
      formats = "notebooks///ipynb,scripts///py"
      fmt = long_form_multiple_formats(formats)[0]
  
      # Notebook in nested 'notebook' dir is paired
      notebook_in_nb_dir = nb_dir.join("subfolder").join("nb.ipynb")
  
      assert {
          path
          for (path, _) in paired_paths(
              str(notebook_in_nb_dir), fmt, formats
          )
      } == {
          str(notebook_in_nb_dir),
          str(src_dir.join("subfolder").join("nb.py")),
      }
  
      # Notebook in base 'notebook' dir is paired if no config file is found
      notebook_in_other_dir = other_dir.mkdir("subfolder").join(
          "nb.ipynb"
      )
      assert {
          path
          for (path, _) in paired_paths(
              str(notebook_in_other_dir), fmt, formats
          )
      } == {
          str(notebook_in_other_dir),
          str(
              tmpdir.join("scripts")
              .join("other")
              .join("subfolder")
              .join("nb.py")
          ),
      }
  
      # When a config file exists
      root_nb_dir.join("jupytext.toml").write("\n")
  
      # Notebook in nested 'notebook' dir is still paired
      assert {
          path
          for (path, _) in paired_paths(
              str(notebook_in_nb_dir), fmt, formats
          )
      } == {
          str(notebook_in_nb_dir),
          str(src_dir.join("subfolder").join("nb.py")),
      }
  
      # But the notebook in base 'notebook' dir is not paired any more
      alert = (
          "Notebook directory '/other/subfolder' does not match prefix root 'notebooks'"
          if os.path.sep == "/"
          # we escape twice the backslash because pytest.raises matches it as a regular expression
          else "Notebook directory '\\\\other\\\\subfolder' does not match prefix root 'notebooks'"
      )
      with pytest.raises(InconsistentPath, match=alert):
          paired_paths(str(notebook_in_other_dir), fmt, formats)
  
imports: import os
  import unittest.mock
  import pytest
  import jupytext
  from jupytext.cli import jupytext
  from jupytext.compare import compare
  from jupytext.contentsmanager import TextFileContentsManager
  from jupytext.formats import long_form_multiple_formats, long_form_one_format, short_form_multiple_formats
  from jupytext.paired_paths import InconsistentPath, base_path, full_path, paired_paths
label_desc: Use image node_id 14 for calling a global function with example usage: test_path_in_tree_limited_to_config_dir(tmpdir) without return types