class_docstr: Test cases for diagnostics infra.
class_docstr_tok: ["Test","cases","for","diagnostics","infra","."]
code: def setUp(self):
      self.rules = _RuleCollectionForTest()
      with contextlib.ExitStack() as stack:
          self.context: infra.DiagnosticContext[
              infra.Diagnostic
          ] = stack.enter_context(
              infra.DiagnosticContext("test", "1.0.0")
          )
          self.addCleanup(stack.pop_all().close)
      return super().setUp()
  
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 1 for calling the TestDiagnosticsInfra obj's underlying member method code with example usage: obj.setUp() and returns: super