code: def test_cumulative_accuracy(self):
      classes_splits = {
          0: {0, 1},
          1: {i for i in range(self.input_size)},
      }
  
      metric = CumulativeAccuracy()
      self.assertDictEqual(metric.result(), {})
  
      # Last cumulative acc corresponds to average acc
      metric.update(classes_splits, self.out, self.y)
      accuracy = (self.out.argmax(1) == self.y).float().mean()
      self.assertEqual(accuracy, metric.result()[1])
  
      # Test reset = 0
      metric.reset()
      expected_results = {c: 0.0 for c in classes_splits}
      result = metric.result()
      for id in expected_results:
          self.assertEqual(result[id], expected_results[id])
      metric.reset()
  
      # Test all wrong = 0
      out_wrong = torch.ones(self.batch_size, self.input_size)
      out_wrong[torch.arange(self.batch_size), self.y] = 0
      metric.update(classes_splits, out_wrong, self.y)
  
      expected_results = {c: 0.0 for c in classes_splits}
      result = metric.result()
      for id in expected_results:
          self.assertEqual(result[id], expected_results[id])
      metric.reset()
  
      # Test all right = 1
      out_right = torch.zeros(self.batch_size, self.input_size)
      out_right[torch.arange(self.batch_size), self.y] = 1
      metric.update(classes_splits, out_right, self.y)
      expected_results = {c: 1.0 for c in classes_splits}
      result = metric.result()
      for id in expected_results:
          self.assertEqual(result[id], expected_results[id])
      metric.reset()
  
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 26 for calling the GeneralMetricTests obj's underlying member method code with example usage: obj.test_cumulative_accuracy() without return types