code: def test_accuracy_task_per_pattern(self):
      metric = TaskAwareAccuracy()
      self.assertEqual(metric.result(), {})
      metric.update(self.out, self.y, self.task_labels)
      out = metric.result()
      for k, v in out.items():
          self.assertIn(k, self.task_labels.tolist())
          self.assertLessEqual(v, 1)
          self.assertGreaterEqual(v, 0)
      metric.reset()
      self.assertEqual(metric.result(), {})
  
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 4 for calling the GeneralMetricTests obj's underlying member method code with example usage: obj.test_accuracy_task_per_pattern() without return types