code: def test_metrics(self):
      class QueryWithMetric(dp_query.SumAggregationDPQuery):
          def __init__(self, metric_val):
              self._metric_val = metric_val
  
          def initial_sample_state(self, template=None):
              del template  # Unused.
              return None
  
          def accumulate_preprocessed_record(
              self, sample_state, preprocessed_record
          ):
              del sample_state, preprocessed_record  # Unused.
              return None
  
          def merge_sample_states(self, sample_state_1, sample_state_2):
              del sample_state_1, sample_state_2  # Unused.
              return None
  
          def get_noised_result(self, sample_state, global_state):
              del sample_state, global_state  # Unused.
              return None
  
          def derive_metrics(self, global_state):
              return collections.OrderedDict(metric=self._metric_val)
  
      query1 = QueryWithMetric(1)
      query2 = QueryWithMetric(2)
      query3 = QueryWithMetric(3)
  
      nested_a = nested_query.NestedSumQuery(query1)
      global_state = nested_a.initial_global_state()
      metric_val = nested_a.derive_metrics(global_state)
      self.assertEqual(metric_val["metric"], 1)
  
      nested_b = nested_query.NestedSumQuery(
          {"key1": query1, "key2": [query2, query3]}
      )
      global_state = nested_b.initial_global_state()
      metric_val = nested_b.derive_metrics(global_state)
      self.assertEqual(metric_val["key1/metric"], 1)
      self.assertEqual(metric_val["key2/0/metric"], 2)
      self.assertEqual(metric_val["key2/1/metric"], 3)
  
file_path: privacy/tensorflow_privacy/privacy/dp_query/nested_query_test.py
imports: import collections
  from absl.testing import parameterized
  import numpy
  import tensorflow
  from tensorflow_privacy.privacy.dp_query import dp_query
  from tensorflow_privacy.privacy.dp_query import gaussian_query
  from tensorflow_privacy.privacy.dp_query import nested_query
  from tensorflow_privacy.privacy.dp_query import normalized_query
  from tensorflow_privacy.privacy.dp_query import test_utils
label_desc: Use image node_id 7 for calling the NestedQueryTest obj's underlying member method code with example usage: obj.test_metrics() and returns: None, None, None, None, collections