code: def test_add_subdataset(path=None, other=None):
      subds = create(op.join(path, "dir"), force=True)
      ds = create(path, force=True)
      ok_(subds.repo.dirty)
      ok_(ds.repo.dirty)
      assert_not_in("dir", ds.subdatasets(result_xfm="relpaths"))
      # "add everything in subds to subds"
      save(dataset=subds.path)
      assert_repo_status(subds.path)
      assert_not_in("dir", ds.subdatasets(result_xfm="relpaths"))
      # but with a base directory we add the dataset subds as a subdataset
      # to ds
      res = ds.save(subds.path)
      assert_in_results(
          res, action="add", path=subds.path, refds=ds.path
      )
      res = ds.subdatasets()
      assert_result_count(res, 1)
      assert_result_count(
          res,
          1,
          # essentials
          path=op.join(ds.path, "dir"),
          gitmodule_url="./dir",
          gitmodule_name="dir",
      )
      #  create another one
      other = create(other)
      # install into superdataset, but don't add
      other_clone = install(
          source=other.path, path=op.join(ds.path, "other")
      )
      # little dance to get the revolution-type dataset
      other_clone = Dataset(other_clone.path)
      ok_(other_clone.is_installed)
      assert_not_in("other", ds.subdatasets(result_xfm="relpaths"))
      # now add, it should pick up the source URL
      ds.save("other")
      # and that is why, we can reobtain it from origin
      ds.drop("other", what="all", reckless="kill", recursive=True)
      ok_(not other_clone.is_installed())
      ds.get("other")
      ok_(other_clone.is_installed())
  
imports: import itertools
  import logging
  import os
  import os.path
  import pytest
  import datalad.utils
  from datalad.api import create, install, save
  from datalad.distribution.dataset import Dataset
  from datalad.support.annexrepo import AnnexRepo
  from datalad.support.exceptions import CommandError
  from datalad.tests.utils_pytest import DEFAULT_BRANCH, OBSCURE_FILENAME, SkipTest, assert_in, assert_in_results, assert_not_in, assert_raises, assert_repo_status, assert_result_count, assert_status, chpwd, create_tree, eq_, known_failure, known_failure_windows, maybe_adjust_repo, neq_, ok_, patch, skip_if_adjusted_branch, skip_wo_symlink_capability, swallow_logs, swallow_outputs, with_tempfile, with_tree
  from datalad.utils import Path, ensure_list, rmtree
label_desc: Use image node_id 13 for calling a global function with example usage: test_add_subdataset(path, other) without return types