code: def _dump_code_block(self):
      docs_dir = Path.cwd()
      repo_root = docs_dir.parent
      directory = docs_dir.joinpath(".examples")
      directory.mkdir(exist_ok=True)
      source, lineno_in_docstring = self.get_source_info()
      obj_path = source.split(":docstring of ")[1]
      code_block_location = get_code_block_location(
          obj_path, lineno_in_docstring, repo_root
      )
      name = re.sub("[\._]+", "_", obj_path).strip("")
      filename = "test_{}_{}.py".format(name, lineno_in_docstring)
      content = textwrap.indent("\n".join(self.content), " " * 4)
      code = "\n".join(
          [
              f"# Location: {code_block_location}",
              "import pytest",
              "",
              "",
              # Show the code block location in the test report.
              f"@pytest.mark.parametrize('_', [' {code_block_location} '])",
              "def test(_):",
              content,
              "",
              "",
              'if __name__ == "__main__":',
              "    test()",
              "",
          ]
      )
      directory.joinpath(filename).write_text(code)
  
file_path: mlflow/docs/source/testcode_block.py
imports: import textwrap
  import importlib
  import inspect
  import functools
  import re
  from pathlib import Path
  from sphinx.directives.code import CodeBlock
label_desc: Use image node_id 1 for calling the TestCodeBlockDirective obj's underlying member method code with example usage: obj._dump_code_block() without return types