code: def test_ls_target(erepo_dir, use_scm):
      with erepo_dir.chdir():
          gen = erepo_dir.scm_gen if use_scm else erepo_dir.dvc_gen
          gen(
              {
                  "dir": {
                      "1": "1",
                      "2": "2",
                      "subdir": {"foo": "foo", "bar": "bar"},
                  }
              },
              commit="create dir",
          )
  
      isout = not use_scm
  
      def _ls(path):
          return Repo.ls(os.fspath(erepo_dir), path)
  
      assert _ls(os.path.join("dir", "1")) == [
          {
              "isout": isout,
              "isdir": False,
              "isexec": False,
              "path": "1",
              "size": 1,
          }
      ]
      assert _ls(os.path.join("dir", "subdir", "foo")) == [
          {
              "isout": isout,
              "isdir": False,
              "isexec": False,
              "path": "foo",
              "size": 3,
          }
      ]
      assert _ls(os.path.join("dir", "subdir")) == [
          {
              "isdir": False,
              "isexec": 0,
              "isout": isout,
              "path": "bar",
              "size": 3,
          },
          {
              "isdir": False,
              "isexec": 0,
              "isout": isout,
              "path": "foo",
              "size": 3,
          },
      ]
  
imports: import os
  import shutil
  import textwrap
  from operator import itemgetter
  import pytest
  from dvc.repo import Repo
  from dvc.scm import CloneError
label_desc: Use image node_id 30 for calling a global function with example usage: test_ls_target(erepo_dir, use_scm) and returns: Repo