code: def test_inheritance(self):
      handler = TestMetricsHandler()
      stream = MetricStream("torchelastic", handler)
      # patch instead of configure to avoid conflicts when running tests in parallel
      with mock.patch(
          "torch.distributed.elastic.metrics.api.getStream",
          return_value=stream,
      ):
          c = Child()
          c.base_func()
  
          self.assertEqual(
              1, handler.metric_data["Child.func.success"].value
          )
          self.assertIn("Child.func.duration.ms", handler.metric_data)
  
imports: import abc
  import unittest.mock
  from torch.distributed.elastic.metrics.api import MetricData, MetricHandler, MetricStream, _get_metric_name, prof
  from torch.testing._internal.common_utils import run_tests, TestCase
label_desc: Use image node_id 7 for calling the MetricsApiTest obj's underlying member method code with example usage: obj.test_inheritance() without return types