code: def test_add():
      ev = ExternalVersions()
      ev.add("custom1", lambda: "0.1.0")
      assert_in("custom1=0.1.0", ev.dumps(query=True))
      assert_not_in(
          "numpy", ev.INTERESTING
      )  # we do not have it by default yet
      assert_not_in("numpy=", ev.dumps(query=True))
      ev.add("numpy")
      try:
          import numpy
      except ImportError:
          # no numpy, we do not have some bogus entry
          assert_not_in("numpy=", ev.dumps(query=True))
      else:
          assert_in(
              "numpy=%s" % numpy.__version__, ev.dumps(query=True)
          )
      assert_in(
          "custom1=0.1.0", ev.dumps(query=True)
      )  # we still have that one
  
      # override with a new function will work
      ev.add("custom1", lambda: "0.2.0")
      assert_in("custom1=0.2.0", ev.dumps(query=True))
  
imports: import logging
  import pytest
  from os import linesep
  from datalad import __version__
  from datalad.cmd import StdOutErrCapture, WitlessRunner
  from datalad.support.annexrepo import AnnexRepo
  from datalad.support.exceptions import CommandError, MissingExternalDependency, OutdatedExternalDependency
  from datalad.tests.utils_pytest import SkipTest, assert_equal, assert_false, assert_greater, assert_greater_equal, assert_in, assert_not_in, assert_raises, assert_true, create_tree, patch, set_annex_version, swallow_logs, with_tempfile
  from ..external_versions import ExternalVersions, LooseVersion
label_desc: Use image node_id 18 for calling a global function with example usage: test_add() without return types