code: def testMetricKeyFromProto(self):
      metric_keys = [
          metric_types.MetricKey(name="metric_name"),
          metric_types.MetricKey(
              name="metric_name",
              model_name="model_name",
              output_name="output_name",
              sub_key=metric_types.SubKey(class_id=1),
              is_diff=True,
          ),
          metric_types.MetricKey(
              name="metric_name",
              model_name="model_name",
              output_name="output_name",
              sub_key=metric_types.SubKey(top_k=2),
              example_weighted=None,
              aggregation_type=metric_types.AggregationType(
                  micro_average=True
              ),
          ),
          metric_types.MetricKey(
              name="metric_name",
              model_name="model_name",
              output_name="output_name",
              example_weighted=False,
          ),
      ]
      for key in metric_keys:
          got_key = metric_types.MetricKey.from_proto(key.to_proto())
          self.assertEqual(
              key, got_key, "{} != {}".format(key, got_key)
          )
  
file_path: model-analysis/tensorflow_model_analysis/metrics/metric_types_test.py
imports: import tensorflow
  from tensorflow_model_analysis.metrics import metric_types
label_desc: Use image node_id 3 for calling the MetricTypesTest obj's underlying member method code with example usage: obj.testMetricKeyFromProto() without return types