code: def test_warning_location(app, status, warning):
      logging.setup(app, status, warning)
      logger = logging.getLogger(__name__)
  
      logger.warning("message1", location="index")
      assert "index.txt: WARNING: message1" in warning.getvalue()
  
      logger.warning("message2", location=("index", 10))
      assert "index.txt:10: WARNING: message2" in warning.getvalue()
  
      logger.warning("message3", location=None)
      assert colorize("red", "WARNING: message3") in warning.getvalue()
  
      node = nodes.Node()
      node.source, node.line = ("index.txt", 10)
      logger.warning("message4", location=node)
      assert "index.txt:10: WARNING: message4" in warning.getvalue()
  
      node.source, node.line = ("index.txt", None)
      logger.warning("message5", location=node)
      assert "index.txt:: WARNING: message5" in warning.getvalue()
  
      node.source, node.line = (None, 10)
      logger.warning("message6", location=node)
      assert "<unknown>:10: WARNING: message6" in warning.getvalue()
  
      node.source, node.line = (None, None)
      logger.warning("message7", location=node)
      assert colorize("red", "WARNING: message7") in warning.getvalue()
  
imports: import codecs
  import os
  import os.path
  import pytest
  from docutils import nodes
  from sphinx.errors import SphinxWarning
  from sphinx.testing.util import strip_escseq
  from sphinx.util import logging, osutil
  from sphinx.util.console import colorize
  from sphinx.util.logging import is_suppressed_warning, prefixed_warnings
  from sphinx.util.parallel import ParallelTasks
label_desc: Use image node_id 10 for calling a global function with example usage: test_warning_location(app, status, warning) without return types