code: def test_pattern_trie_fs(tmp_dir, dvc):
      tmp_dir.gen(
          {
              "top": {
                  "first": {
                      DvcIgnore.DVCIGNORE_FILE: "a\nb\nc",
                      "middle": {
                          "second": {
                              DvcIgnore.DVCIGNORE_FILE: "d\ne\nf",
                              "bottom": {},
                          }
                      },
                  }
              },
              "other": {DvcIgnore.DVCIGNORE_FILE: "1\n2\n3"},
          }
      )
      dvc._reset()
      dvcignore = dvc.dvcignore
  
      ignore_pattern_top = dvcignore._get_trie_pattern(
          os.fspath(tmp_dir / "top")
      )
      ignore_pattern_other = dvcignore._get_trie_pattern(
          os.fspath(tmp_dir / "other")
      )
      ignore_pattern_first = dvcignore._get_trie_pattern(
          os.fspath(tmp_dir / "top" / "first")
      )
      ignore_pattern_middle = dvcignore._get_trie_pattern(
          os.fspath(tmp_dir / "top" / "first" / "middle")
      )
      ignore_pattern_second = dvcignore._get_trie_pattern(
          os.fspath(tmp_dir / "top" / "first" / "middle" / "second")
      )
      ignore_pattern_bottom = dvcignore._get_trie_pattern(
          os.fspath(
              tmp_dir / "top" / "first" / "middle" / "second" / "bottom"
          )
      )
  
      base_pattern = (
          _to_pattern_info_list([".hg/", ".git/", ".git", ".dvc/"]),
          os.fspath(tmp_dir),
      )
      first_pattern = merge_patterns(
          os.path,
          *base_pattern,
          _to_pattern_info_list(["a", "b", "c"]),
          os.fspath(tmp_dir / "top" / "first"),
      )
      second_pattern = merge_patterns(
          os.path,
          *first_pattern,
          _to_pattern_info_list(["d", "e", "f"]),
          os.fspath(tmp_dir / "top" / "first" / "middle" / "second"),
      )
      other_pattern = merge_patterns(
          os.path,
          *base_pattern,
          _to_pattern_info_list(["1", "2", "3"]),
          os.fspath(tmp_dir / "other"),
      )
  
      assert (
          DvcIgnorePatterns(*base_pattern, os.sep) == ignore_pattern_top
      )
      assert (
          DvcIgnorePatterns(*other_pattern, os.sep)
          == ignore_pattern_other
      )
      assert (
          DvcIgnorePatterns(*first_pattern, os.sep)
          == ignore_pattern_first
          == ignore_pattern_middle
      )
      assert (
          DvcIgnorePatterns(*second_pattern, os.sep)
          == ignore_pattern_second
          == ignore_pattern_bottom
      )
  
imports: import os
  import shutil
  from pathlib import Path
  from typing import List
  import pytest
  from dvc.ignore import DvcIgnore, DvcIgnorePatterns
  from dvc.output import OutputIsIgnoredError
  from dvc.pathspec_math import PatternInfo, merge_patterns
  from dvc.repo import Repo
  from dvc.testing.tmp_dir import TmpDir
  from dvc_data.hashfile.build import IgnoreInCollectedDirError
  from dvc_data.hashfile.utils import get_mtime_and_size
label_desc: Use image node_id 19 for calling a global function with example usage: test_pattern_trie_fs(tmp_dir, dvc) without return types