class_docstr: Test cases for diagnostics emitted by the Dynamo ONNX export code.
class_docstr_tok: ["Test","cases","for","diagnostics","emitted","by","the","Dynamo","ONNX","export","code","."]
code: def test_log_diagnostic_to_diagnostic_context_raises_when_diagnostic_type_is_wrong(
      self,
  ):
      with self.diagnostic_context:
          # Dynamo onnx exporter diagnostic context expects fx_diagnostics.Diagnostic
          # instead of base infra.Diagnostic.
          diagnostic = infra.Diagnostic(
              self.rules.rule_without_message_args, infra.Level.NOTE
          )
          with self.assertRaises(TypeError):
              self.diagnostic_context.log(diagnostic)
  
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 7 for calling the TestDynamoOnnxDiagnostics obj's underlying member method code with example usage: obj.test_log_diagnostic_to_diagnostic_context_raises_when_diagnostic_type_is_wrong() without return types