code: def test_implicit_install(src=None, dst=None):
      origin_top = create(src)
      origin_sub = origin_top.create("sub")
      origin_subsub = origin_sub.create("subsub")
      with open(opj(origin_top.path, "file1.txt"), "w") as f:
          f.write("content1")
      origin_top.save("file1.txt")
      with open(opj(origin_sub.path, "file2.txt"), "w") as f:
          f.write("content2")
      origin_sub.save("file2.txt")
      with open(opj(origin_subsub.path, "file3.txt"), "w") as f:
          f.write("content3")
      origin_subsub.save("file3.txt")
      origin_top.save(recursive=True)
  
      # first, install toplevel:
      ds = install(dst, source=src)
      ok_(ds.is_installed())
  
      sub = Dataset(opj(ds.path, "sub"))
      ok_(not sub.is_installed())
      subsub = Dataset(opj(sub.path, "subsub"))
      ok_(not subsub.is_installed())
  
      # fail on obscure non-existing one
      assert_raises(
          IncompleteResultsError, ds.install, source="obscure"
      )
  
      # install 3rd level and therefore implicitly the 2nd:
      result = ds.install(path=opj("sub", "subsub"))
      ok_(sub.is_installed())
      ok_(subsub.is_installed())
      # but by default implicit results are not reported
      eq_(result, subsub)
  
      # fail on obscure non-existing one in subds
      assert_raises(
          IncompleteResultsError,
          ds.install,
          source=opj("sub", "obscure"),
      )
  
      # clean up, the nasty way
      rmtree(dst, chmod_files=True)
      ok_(not exists(dst))
  
      # again first toplevel:
      ds = install(dst, source=src)
      ok_(ds.is_installed())
      sub = Dataset(opj(ds.path, "sub"))
      ok_(not sub.is_installed())
      subsub = Dataset(opj(sub.path, "subsub"))
      ok_(not subsub.is_installed())
  
      # now implicit but without an explicit dataset to install into
      # (deriving from CWD):
      with chpwd(dst):
          # don't ask for the file content to make return value comparison
          # simpler
          result = get(
              path=opj("sub", "subsub"),
              get_data=False,
              result_xfm="datasets",
          )
          ok_(sub.is_installed())
          ok_(subsub.is_installed())
          eq_(result, [sub, subsub])
  
imports: import logging
  import os
  from os.path import basename, dirname, exists, isdir
  from os.path import join
  from unittest.mock import patch
  import pytest
  from datalad import cfg
  from datalad.api import create, get, install
  from datalad.cmd import WitlessRunner
  from datalad.interface.results import YieldDatasets
  from datalad.support import path
  from datalad.support.annexrepo import AnnexRepo
  from datalad.support.exceptions import IncompleteResultsError, InsufficientArgumentsError
  from datalad.support.gitrepo import GitRepo
  from datalad.support.network import get_local_file_url
  from datalad.tests.utils_testdatasets import _make_dataset_hierarchy, _mk_submodule_annex
  from datalad.tests.utils_pytest import DEFAULT_BRANCH, DEFAULT_REMOTE, assert_false, assert_in, assert_in_results, assert_is_instance, assert_not_in, assert_raises, assert_repo_status, assert_result_count, assert_status, create_tree, eq_, get_datasets_topdir, integration, known_failure_githubci_win, known_failure_windows, ok_, ok_file_has_content, ok_startswith, put_file_under_git, serve_path_via_http, skip_if_no_network, skip_if_on_windows, skip_ssh, slow, swallow_logs, use_cassette, usecase, with_tempfile, with_tree
  from datalad.utils import Path, _path_, chpwd, getpwd, on_windows, rmtree
  from ..dataset import Dataset
label_desc: Use image node_id 15 for calling a global function with example usage: test_implicit_install(src, dst) without return types