code: def test_class_accuracy_static(self):
      with self.assertRaises(Exception):
          metric = ClassAccuracy(
              classes={0: (0, 1, 2, "aaa"), 1: (0, 1, 2)}
          )
  
      metric = ClassAccuracy(classes={0: (0, 1, 2), 1: (0, 1, 2)})
      self.assertDictEqual(
          metric.result(),
          {0: {0: 0.0, 1: 0.0, 2: 0.0}, 1: {0: 0.0, 1: 0.0, 2: 0.0}},
      )
  
      metric.reset()
      self.assertDictEqual(
          metric.result(),
          {0: {0: 0.0, 1: 0.0, 2: 0.0}, 1: {0: 0.0, 1: 0.0, 2: 0.0}},
      )
  
      my_y = torch.as_tensor([0, 0, 1, 0, 2, 2, 0])
      my_out = torch.as_tensor([0, 0, 1, 2, 1, 1, 1])
      # 0: 50%, 1: 100%, 2: 0%
      metric.update(my_out, my_y, 0)
  
      self.assertDictEqual(
          metric.result(),
          {0: {0: 0.5, 1: 1.00, 2: 0.0}, 1: {0: 0.0, 1: 0.0, 2: 0.0}},
      )
  
      metric.reset()
      self.assertDictEqual(
          metric.result(),
          {0: {0: 0.0, 1: 0.0, 2: 0.0}, 1: {0: 0.0, 1: 0.0, 2: 0.0}},
      )
  
      # Add a task
      metric.update(my_out, my_y, 1)
      self.assertDictEqual(
          metric.result(),
          {0: {0: 0.0, 1: 0.0, 2: 0.0}, 1: {0: 0.5, 1: 1.00, 2: 0.0}},
      )
  
      metric.reset()
      self.assertDictEqual(
          metric.result(),
          {
              0: {0: 0.0, 1: 0.0, 2: 0.0},
              1: {0: 0.0, 1: 0.0, 2: 0.0},
          },
      )
  
imports: import unittest
  import torch
  from avalanche.evaluation.metrics import TaskAwareAccuracy, TopkAccuracy, AverageMeanClassAccuracy, MultiStreamAMCA, ClassAccuracy, TaskAwareLoss, ConfusionMatrix, DiskUsage, MAC, CPUUsage, MaxGPU, MaxRAM, Mean, Sum, ElapsedTime, Forgetting, ForwardTransfer, CumulativeAccuracy, LabelsRepartition
  from tests.unit_tests_utils import FAST_TEST, is_github_action
label_desc: Use image node_id 7 for calling the GeneralMetricTests obj's underlying member method code with example usage: obj.test_class_accuracy_static() without return types