code: def test_model_card_encoder():
      class ExampleClass(object):
          """Example class"""
  
          attr1 = _OneOf(schema_constraints.MetricTypeEnum)
  
          def __init__(self, attr1: schema_constraints.MetricTypeEnum):
              """Initialize an example class"""
              self.attr1 = attr1
  
          def _to_request_dict(self):
              """example method to return the _to_request_dict"""
              return {"attr1": self.attr1, "attr2": "test"}
  
      my_object = ExampleClass(
          attr1=schema_constraints.MetricTypeEnum.LINEAR_GRAPH
      )
  
      assert (
          json.dumps(my_object, cls=_JSONEncoder, sort_keys=True)
          == '{"attr1": "linear_graph", "attr2": "test"}'
      )
  
imports: from __future__ import absolute_import
  import io
  import os
  import json
  import datetime
  import re
  import logging
  import pytest
  from mock import patch, Mock
  from botocore.exceptions import ClientError
  import botocore.response
  from sagemaker.model_card import schema_constraints
  from sagemaker.model_card import Environment, ModelOverview, IntendedUses, BusinessDetails, ObjectiveFunction, TrainingMetric, HyperParameter, Metric, TrainingDetails, MetricGroup, EvaluationJob, AdditionalInformation, ModelCard, Function, TrainingJobDetails, ModelPackage
  from sagemaker.model_card.model_card import ModelCardExportJob, ModelPackageCreator, SourceAlgorithm, Container, InferenceSpecification
  from sagemaker.model_card.helpers import _MaxSizeArray, _IsList, _OneOf, _IsModelCardObject, _JSONEncoder, _hash_content_str, _DefaultToRequestDict, _SkipEncodingDecoding
  from sagemaker.model_card.evaluation_metric_parsers import EvaluationMetricTypeEnum, EVALUATION_METRIC_PARSERS
label_desc: Use image node_id 25 for calling a global function with example usage: test_model_card_encoder() and returns: dict