code: def test_classification_stats_report():
      from io import StringIO
      from speechbrain.utils.metric_stats import ClassificationStats
  
      stats = ClassificationStats()
      stats.append(
          ids=["1", "2"], predictions=["B", "A"], targets=["B", "A"]
      )
      stats.append(
          ids=["3", "4"], predictions=["A", "B"], targets=["B", "C"]
      )
      report_file = StringIO()
      stats.write_stats(report_file)
      report_file.seek(0)
      report = report_file.read()
      ref_report = """Overall Accuracy: 50%
  
  Class-Wise Accuracy
  -------------------
  A: 1 / 1 (100.00%)
  B: 1 / 2 (50.00%)
  C: 0 / 1 (0.00%)
  
  Confusion
  ---------
  Target: A
    -> A: 1 / 1 (100.00%)
  Target: B
    -> A: 1 / 2 (50.00%)
    -> B: 1 / 2 (50.00%)
  Target: C
    -> B: 1 / 1 (100.00%)
  """
      assert report == ref_report
  
file_path: speechbrain/tests/unittests/test_metrics.py
imports: import torch
  import torch.nn
  import math
label_desc: Use image node_id 8 for calling a global function with example usage: test_classification_stats_report() without return types