code: def testPutParentContextIfNotExists(self):
      with metadata.Metadata(
          connection_config=self._connection_config
      ) as m:
          parent_context = context_lib.register_context_if_not_exists(
              metadata_handle=m,
              context_type_name="my_context_type",
              context_name="parent_context_name",
          )
          child_context = context_lib.register_context_if_not_exists(
              metadata_handle=m,
              context_type_name="my_context_type",
              context_name="child_context_name",
          )
          context_lib.put_parent_context_if_not_exists(
              m, parent_id=parent_context.id, child_id=child_context.id
          )
          # Duplicated call should succeed.
          context_lib.put_parent_context_if_not_exists(
              m, parent_id=parent_context.id, child_id=child_context.id
          )
  
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 6 for calling the ContextLibTest obj's underlying member method code with example usage: obj.testPutParentContextIfNotExists() without return types