code: def test_dir(self, cloud):
      cloud.gen(
          {"dir/foo": "foo contents", "dir/subdir/bar": "bar contents"}
      )
      if not (cloud / "dir").is_dir():
          pytest.skip("Cannot create directories on this cloud")
      fs, _ = parse_external_url(cloud.url, cloud.config)
      result = ls_url(str(cloud / "dir"), fs_config=cloud.config)
      match_files(
          fs,
          result,
          [
              {"path": "foo", "isdir": False},
              {"path": "subdir", "isdir": True},
          ],
      )
  
imports: import os
  from typing import Dict, Union
  import pytest
  from funcy import first
  from dvc.exceptions import URLMissingError
  from dvc.repo import Repo
  from dvc.repo.ls_url import ls_url, parse_external_url
  from dvc.utils.fs import remove
label_desc: Use image node_id 2 for calling the TestLsUrl obj's underlying member method code with example usage: obj.test_dir(cloud) without return types