code: def test_separate_metadata():
      # metadata only
      text = ":meta foo: bar\n" ":meta baz:\n"
      docstring, metadata = separate_metadata(text)
      assert docstring == ""
      assert metadata == {"foo": "bar", "baz": ""}
  
      # non metadata field list item
      text = ":meta foo: bar\n" ":param baz:\n"
      docstring, metadata = separate_metadata(text)
      assert docstring == ":param baz:\n"
      assert metadata == {"foo": "bar"}
  
      # field_list like text following just after paragraph is not a field_list
      text = "blah blah blah\n" ":meta foo: bar\n" ":meta baz:\n"
      docstring, metadata = separate_metadata(text)
      assert docstring == text
      assert metadata == {}
  
      # field_list like text following after blank line is a field_list
      text = "blah blah blah\n" "\n" ":meta foo: bar\n" ":meta baz:\n"
      docstring, metadata = separate_metadata(text)
      assert docstring == "blah blah blah\n\n"
      assert metadata == {"foo": "bar", "baz": ""}
  
      # non field_list item breaks field_list
      text = ":meta foo: bar\n" "blah blah blah\n" ":meta baz:\n"
      docstring, metadata = separate_metadata(text)
      assert docstring == ("blah blah blah\n" ":meta baz:\n")
      assert metadata == {"foo": "bar"}
  
imports: from sphinx.util.docstrings import prepare_commentdoc, prepare_docstring, separate_metadata
label_desc: Use image node_id 1 for calling a global function with example usage: test_separate_metadata() without return types