code: def testRegisterContextByTypeAndName(self):
      with metadata.Metadata(
          connection_config=self._connection_config
      ) as m:
          context_lib.register_context_if_not_exists(
              metadata_handle=m,
              context_type_name="my_context_type",
              context_name="my_context",
          )
          # Duplicated call should succeed.
          context = context_lib.register_context_if_not_exists(
              metadata_handle=m,
              context_type_name="my_context_type",
              context_name="my_context",
          )
  
          got_context_type = m.store.get_context_type("my_context_type")
          got_context_type.ClearField("id")
          self.assertProtoEquals(
              """
            name: 'my_context_type'
            """,
              got_context_type,
          )
          self.assertEqual(
              context,
              m.store.get_context_by_type_and_name(
                  "my_context_type", "my_context"
              ),
          )
  
file_path: tfx/tfx/orchestration/portable/mlmd/context_lib_test.py
imports: import os
  import tensorflow
  from tfx.orchestration import metadata
  from tfx.orchestration.portable.mlmd import context_lib
  from tfx.proto.orchestration import pipeline_pb2
  from tfx.utils import test_case_utils
  from ml_metadata.proto import metadata_store_pb2
label_desc: Use image node_id 4 for calling the ContextLibTest obj's underlying member method code with example usage: obj.testRegisterContextByTypeAndName() without return types