code: def test_doc_id_comment(doc):
      """
      Test that setting the doc_id on a sentence sets the document comment
      """
      assert doc.sentences[0].doc_id is None
      assert (
          len(
              [
                  x
                  for x in doc.sentences[0].comments
                  if x.startswith("# doc_id")
              ]
          )
          == 0
      )
  
      doc.sentences[0].doc_id = "foo"
      assert (
          len(
              [
                  x
                  for x in doc.sentences[0].comments
                  if x.startswith("# doc_id")
              ]
          )
          == 1
      )
      assert "# doc_id = foo" in doc.sentences[0].comments
      assert doc.sentences[0].doc_id == "foo"
  
      doc.sentences[0].add_comment("# doc_id = bar")
      assert (
          len(
              [
                  x
                  for x in doc.sentences[0].comments
                  if x.startswith("# doc_id")
              ]
          )
          == 1
      )
      assert doc.sentences[0].doc_id == "bar"
  
file_path: stanza/stanza/tests/common/test_doc.py
imports: import pytest
  import stanza
  from stanza.tests import *
  from stanza.models.common.doc import Document, ID, TEXT, NER, CONSTITUENCY, SENTIMENT
label_desc: Use image node_id 9 for calling a global function with example usage: test_doc_id_comment(doc) without return types