code: def test_create_sub(path=None):
      ds = Dataset(path)
      ds.create()
  
      # 1. create sub and add to super:
      subds = ds.create(op.join("some", "what", "deeper"))
      ok_(isinstance(subds, Dataset))
      ok_(subds.is_installed())
      assert_repo_status(subds.path, annex=True)
      assert_in(
          "submodule.some/what/deeper.datalad-id={}".format(subds.id),
          list(
              ds.repo.call_git_items_(
                  ["config", "--file", ".gitmodules", "--list"],
                  read_only=True,
              )
          ),
      )
  
      # subdataset is known to superdataset:
      assert_in(
          op.join("some", "what", "deeper"),
          ds.subdatasets(result_xfm="relpaths"),
      )
      # and was committed:
      assert_repo_status(ds.path)
  
      # subds finds superdataset
      ok_(subds.get_superdataset() == ds)
  
      # 2. create sub without adding to super:
      subds2 = Dataset(op.join(path, "someother")).create()
      ok_(isinstance(subds2, Dataset))
      ok_(subds2.is_installed())
      assert_repo_status(subds2.path, annex=True)
  
      # unknown to superdataset:
      assert_not_in("someother", ds.subdatasets(result_xfm="relpaths"))
  
      # 3. create sub via super:
      subds3 = ds.create("third", annex=False)
      ok_(isinstance(subds3, Dataset))
      ok_(subds3.is_installed())
      assert_repo_status(subds3.path, annex=False)
      assert_in("third", ds.subdatasets(result_xfm="relpaths"))
  
imports: import os
  import os.path
  import pytest
  from datalad.api import create
  from datalad.cmd import WitlessRunner
  from datalad.distribution.dataset import Dataset
  from datalad.support.annexrepo import AnnexRepo
  from datalad.support.exceptions import CommandError
  from datalad.tests.utils_pytest import OBSCURE_FILENAME, assert_in, assert_in_results, assert_not_in, assert_raises, assert_repo_status, assert_status, eq_, has_symlink_capability, ok_, ok_exists, swallow_outputs, with_tempfile, with_tree
  from datalad.utils import Path, chpwd
label_desc: Use image node_id 5 for calling a global function with example usage: test_create_sub(path) without return types