code: def testCheckCycle(self):
      def yes(nodes, dependencies):
          with self.assertRaises(exceptions.FailedPreconditionError):
              node_inputs_resolver._check_cycle(nodes, dependencies)
  
      def no(nodes, dependencies):
          try:
              node_inputs_resolver._check_cycle(nodes, dependencies)
          except exceptions.FailedPreconditionError:
              self.fail("Expected no cycle but has cycle.")
  
      no("", {})
      yes("a", {"a": "a"})
      yes("ab", {"a": "b", "b": "a"})
      yes("abc", {"a": "b", "b": "c", "c": "a"})
      no("abcd", {"a": "bcd", "b": "", "c": "", "d": ""})
      no("abcd", {"a": "bc", "b": "d", "c": "d", "d": ""})
  
imports: from typing import Set
  from unittest import mock
  import tensorflow
  from tfx.orchestration.portable.input_resolution import exceptions
  from tfx.orchestration.portable.input_resolution import input_graph_resolver
  from tfx.orchestration.portable.input_resolution import node_inputs_resolver
  from tfx.orchestration.portable.input_resolution import partition_utils
  from tfx.orchestration.portable.input_resolution import channel_resolver
  from tfx.proto.orchestration import pipeline_pb2
  import tfx.types
  from tfx.types import channel_utils
  from tfx.utils import test_case_utils
  from google.protobuf import text_format
label_desc: Use image node_id 2 for calling the ProtectedFunctionTest obj's underlying member method code with example usage: obj.testCheckCycle() without return types