class_docstr: Test cases for diagnostics infra.
class_docstr_tok: ["Test","cases","for","diagnostics","infra","."]
code: def test_diagnostic_nested_log_section_emits_messages_with_correct_section_title_indentation(
      self,
  ):
      verbosity_level = logging.INFO
      self.context.options.verbosity_level = verbosity_level
      with self.context:
          diagnostic = infra.Diagnostic(
              self.rules.rule_without_message_args, infra.Level.NOTE
          )
  
          with diagnostic.log_section(logging.INFO, "My Section"):
              diagnostic.log(logging.INFO, "My Message")
              with diagnostic.log_section(
                  logging.INFO, "My Subsection"
              ):
                  diagnostic.log(logging.INFO, "My Submessage")
  
          with diagnostic.log_section(logging.INFO, "My Section 2"):
              diagnostic.log(logging.INFO, "My Message 2")
  
          self.assertIn("## My Section", diagnostic.additional_messages)
          self.assertIn(
              "### My Subsection", diagnostic.additional_messages
          )
          self.assertIn(
              "## My Section 2", diagnostic.additional_messages
          )
  
imports: from __future__ import annotations
  import contextlib
  import dataclasses
  import io
  import logging
  import typing
  import unittest
  from typing import AbstractSet, Protocol, Tuple
  import torch
  from torch.onnx import errors
  from torch.onnx._internal import diagnostics
  from torch.onnx._internal.diagnostics import infra
  from torch.onnx._internal.diagnostics.infra import formatter, sarif
  from torch.onnx._internal.fx import diagnostics
  from torch.testing._internal import common_utils, logging_utils
label_desc: Use image node_id 9 for calling the TestDiagnosticsInfra obj's underlying member method code with example usage: obj.test_diagnostic_nested_log_section_emits_messages_with_correct_section_title_indentation() without return types