code: def test_composed_metrics(self):
      DefaultScope.get_instance("mmocr_metric", scope_name="mmocr")
      cfg = [
          dict(type="ToyMetric"),
          dict(type="ToyMetric", dummy_metrics=dict(mAP=0.0)),
      ]
  
      evaluator = MultiDatasetsEvaluator(cfg, dataset_prefixes=["Fake"])
      evaluator.dataset_meta = {}
      size = 10
      batch_size = 4
  
      for data_samples, predictions in generate_test_results(
          size, batch_size, pred=1, label=1
      ):
          evaluator.process(predictions, data_samples)
  
      metrics = evaluator.evaluate(size=size)
  
      self.assertAlmostEqual(metrics["Fake/Toy/accuracy"], 1.0)
      self.assertAlmostEqual(metrics["Fake/Toy/mAP"], 0.0)
      self.assertEqual(metrics["Fake/Toy/size"], size)
      with self.assertWarns(Warning):
          evaluator.evaluate(size=0)
  
      cfg = [dict(type="ToyMetric"), dict(type="ToyMetric")]
  
      evaluator = MultiDatasetsEvaluator(cfg, dataset_prefixes=["Fake"])
      evaluator.dataset_meta = {}
  
      for data_samples, predictions in generate_test_results(
          size, batch_size, pred=1, label=1
      ):
          evaluator.process(predictions, data_samples)
      with self.assertRaises(ValueError):
          evaluator.evaluate(size=size)
  
      cfg = [
          dict(type="ToyMetric"),
          dict(type="ToyMetric", prefix=None),
      ]
  
      evaluator = MultiDatasetsEvaluator(cfg, dataset_prefixes=["Fake"])
      evaluator.dataset_meta = {}
  
      for data_samples, predictions in generate_test_results(
          size, batch_size, pred=1, label=1
      ):
          evaluator.process(predictions, data_samples)
      metrics = evaluator.evaluate(size=size)
      self.assertIn("Fake/Toy/accuracy", metrics)
      self.assertIn("Fake/accuracy", metrics)
  
file_path: mmocr/tests/test_evaluation/test_evaluator/test_multi_datasets_evaluator.py
imports: import math
  from typing import Dict, List, Optional
  from unittest import TestCase
  import numpy
  from mmengine.evaluator import BaseMetric
  from mmengine.registry import METRICS, DefaultScope
  from mmengine.structures import BaseDataElement
  from mmocr.evaluation import MultiDatasetsEvaluator
label_desc: Use image node_id 1 for calling the TestMultiDatasetsEvaluator obj's underlying member method code with example usage: obj.test_composed_metrics() without return types