code: def test_check_sub_dir_ignore_file(tmp_dir, dvc, capsys):
      tmp_dir.gen(
          {
              DvcIgnore.DVCIGNORE_FILE: "other",
              "dir": {
                  DvcIgnore.DVCIGNORE_FILE: "bar\nfoo",
                  "foo": "bar",
              },
          }
      )
  
      assert (
          main(["check-ignore", "-d", os.path.join("dir", "foo")]) == 0
      )
  
      out, _ = capsys.readouterr()
      assert (
          "{}:2:foo\t{}".format(
              os.path.join("dir", DvcIgnore.DVCIGNORE_FILE),
              os.path.join("dir", "foo"),
          )
          in out
      )
  
      sub_dir = tmp_dir / "dir"
      with sub_dir.chdir():
          assert main(["check-ignore", "-d", "foo"]) == 0
          out, _ = capsys.readouterr()
          assert ".dvcignore:2:foo\tfoo" in out
  
file_path: dvc/tests/func/test_check_ignore.py
imports: import os
  import pytest
  from dvc.cli import main
  from dvc.ignore import DvcIgnore
label_desc: Use image node_id 9 for calling a global function with example usage: test_check_sub_dir_ignore_file(tmp_dir, dvc, capsys) without return types