code: def test_artifacts_in_config(user, sample_data, test_settings):
      with wandb.init(settings=test_settings()) as run:
          artifact = run.use_artifact("boom-data:v0")
          logged_artifact = wandb.Artifact("my-arti", type="dataset")
          run.log_artifact(logged_artifact)
          logged_artifact.wait()
          run.config.dataset = artifact
          run.config.logged_artifact = logged_artifact
          run.config.update({"myarti": artifact})
          with pytest.raises(ValueError) as e_info:
              run.config.nested_dataset = {"nested": artifact}
          assert (
              str(e_info.value)
              == "Instances of wandb.Artifact can only be top level keys in wandb.config"
          )
  
          with pytest.raises(ValueError) as e_info:
              run.config.dict_nested = {
                  "one_nest": {"two_nest": artifact}
              }
          assert (
              str(e_info.value)
              == "Instances of wandb.Artifact can only be top level keys in wandb.config"
          )
  
          with pytest.raises(ValueError) as e_info:
              run.config.update({"one_nest": {"two_nest": artifact}})
          assert (
              str(e_info.value)
              == "Instances of wandb.Artifact can only be top level keys in wandb.config"
          )
  
      run = wandb.Api().run(f"uncategorized/{run.id}")
      assert run.config["dataset"] == {
          "_type": "artifactVersion",
          "_version": "v0",
          "id": artifact.id,
          "version": "v0",
          "sequenceName": artifact.source_name.split(":")[0],
          "usedAs": "dataset",
      }
  
      assert run.config["myarti"] == {
          "_type": "artifactVersion",
          "_version": "v0",
          "id": artifact.id,
          "version": "v0",
          "sequenceName": artifact.source_name.split(":")[0],
          "usedAs": "myarti",
      }
  
      assert run.config["logged_artifact"] == {
          "_type": "artifactVersion",
          "_version": "v0",
          "id": logged_artifact.id,
          "version": "v0",
          "sequenceName": logged_artifact.name.split(":")[0],
          "usedAs": "logged_artifact",
      }
  
imports: import json
  from unittest import mock
  import pytest
  import wandb
label_desc: Use image node_id 2 for calling a global function with example usage: test_artifacts_in_config(user, sample_data, test_settings) without return types