code: def test_artifacts_add_subdir(tmp_dir, dvc):
      subdir = tmp_dir / "subdir"
      subdir.mkdir()
  
      (subdir / "dvc.yaml").dump(dvcyaml)
  
      new_art = Artifact(path="path")
      tmp_dir.dvc.artifacts.add(
          "new", new_art, dvcfile="subdir/dvc.yaml"
      )
  
      artifacts = {
          name: Artifact(**values)
          for name, values in dvcyaml["artifacts"].items()
      }
      artifacts["new"] = new_art
      assert tmp_dir.dvc.artifacts.read() == {
          f"subdir{os.path.sep}dvc.yaml": artifacts,
      }
  
file_path: dvc/tests/func/artifacts/test_artifacts.py
imports: import logging
  import os
  from copy import deepcopy
  import pytest
  from dvc.annotations import Artifact
  from dvc.exceptions import ArtifactNotFoundError, InvalidArgumentError
  from dvc.repo.artifacts import check_name_format
  from dvc.utils.strictyaml import YAMLSyntaxError, YAMLValidationError
label_desc: Use image node_id 3 for calling a global function with example usage: test_artifacts_add_subdir(tmp_dir, dvc) without return types