# Path: tensorflow_transform/nodes.py
# class ValueNode(
#     tfx_namedtuple.namedtuple('ValueNode',
#                               ['parent_operation', 'value_index'])):
# class OperationDef(metaclass=abc.ABCMeta):
# class OperationNode:
# class Visitor(metaclass=abc.ABCMeta):
# class Traverser:
# class _PrintGraphVisitor(Visitor):
#   def __init__(self, parent_operation, value_index: int):
#   def __iter__(self):
#   def num_outputs(self) -> int:
#   def label(self) -> str:
#   def get_field_str(self, field_name: str) -> str:
#   def is_partitionable(self) -> bool:
#   def cache_coder(self) -> Optional[object]:
#   def __init__(self, operation_def, inputs):
#   def __repr__(self):
#   def operation_def(self):
#   def inputs(self):
#   def outputs(self):
# def apply_operation(operation_def_cls, *args, **kwargs):
# def apply_multi_output_operation(operation_def_cls, *args, **kwargs):
#   def validate_value(self, value):
#   def visit(self, operation_def, input_values):
#   def __init__(self, visitor: Visitor):
#   def visit_value_node(self, value_node: ValueNode):
#   def _maybe_visit_value_node(self, value_node: ValueNode):
#   def _visit_operation(self, operation: OperationNode):
# def _escape(line: str) -> str:
#   def __init__(self):
#   def get_dot_graph(self) -> pydot.Dot:
#   def visit(self, operation_def, input_nodes) -> Tuple[pydot.Node, ...]:
#   def validate_value(self, value: pydot.Node):
# def get_dot_graph(leaf_nodes: Collection[ValueNode]) -> pydot.Dot:
# 
# Path: tensorflow_transform/test_case.py
# def is_tf_api_version_1():
# def cross_named_parameters(*args):
#   def _cross_test_cases(parameters_list):
# def parameters(*testcases):
#   def wrapper(fn):
#     def to_arg_dict(testcase):
# def cross_parameters(*args):
# def _make_placeholder(tensor_spec):
# def _graph_function_handler(input_signature):
#   def wrapper(fn):
#     def _run_graph(*inputs):
# def _ragged_value_as_constant(value, dtype):
# def _wrap_as_constant(value, tensor_spec):
# def _eager_function_handler(input_signature):
#   def wrapper(fn):
#     def _run_eagerly(*inputs):  # pylint: disable=missing-docstring
# def _tf_function_function_handler(input_signature):
#   def wrapper(fn):
# def is_external_environment():
# def skip_if_external_environment(reason):
# def skip_if_not_tf2(reason):
# def cross_with_function_handlers(parameters_list):
#   def assertDataCloseOrEqual(self, a_data, b_data):
#   def _assertValuesCloseOrEqual(self, a_value, b_value, msg=None):
#   def AssertVocabularyContents(self, vocab_file_path, file_contents):
#   def WriteRenderedDotFile(self, dot_string, output_file=None):
#   def _NumpyArraysToLists(self, maybe_arrays):
#   def _SortedDicts(self, list_of_dicts):
#   def _SortedData(self, list_of_dicts_of_arrays):
# FUNCTION_HANDLERS = [
#     dict(testcase_name='graph',
#          function_handler=_graph_function_handler),
#     dict(testcase_name='eager',
#          function_handler=_eager_function_handler),
#     dict(testcase_name='tf_function',
#          function_handler=_tf_function_function_handler)
# ]
# class TransformTestCase(parameterized.TestCase, tf.test.TestCase):


import tensorflow as tf
from tensorflow_transform import nodes
from tensorflow_transform import test_case
from tfx_bsl.types import tfx_namedtuple
        mock.call.validate_value('a'),
        mock.call.visit(_Concat('Concat[0]'), ('b', 'a')),
        mock.call.validate_value('ba'),
        mock.call.visit(_Constant('c', 'Constant[c]'), ()),
        mock.call.validate_value('c'),
        mock.call.visit(_Concat('Concat[1]'), ('ba', 'c')),
        mock.call.validate_value('bac'),
    ])

  def testTraverserOutputsNotATuple(self):
    a = nodes.apply_operation(_Constant, value='a', label='Constant[a]')

    mock_visitor = mock.MagicMock()
    mock_visitor.visit.side_effect = [42]

    with self.assertRaisesRegexp(
        ValueError, r'expected visitor to return a tuple, got'):
      nodes.Traverser(mock_visitor).visit_value_node(a)

  def testTraverserBadNumOutputs(self):
    a = nodes.apply_operation(_Constant, value='a', label='Constant[a]')
    mock_visitor = mock.MagicMock()
    mock_visitor.visit.side_effect = [('a', 'b')]

    with self.assertRaisesRegexp(
        ValueError, 'has 1 outputs but visitor returned 2 values: '):
      nodes.Traverser(mock_visitor).visit_value_node(a)

  def testTraverserCycle(self):
    a = nodes.apply_operation(_Constant, value='a', label='Constant[a]')

# Path: tensorflow_transform/nodes.py
# class ValueNode(
#     tfx_namedtuple.namedtuple('ValueNode',
#                               ['parent_operation', 'value_index'])):
# class OperationDef(metaclass=abc.ABCMeta):
# class OperationNode:
# class Visitor(metaclass=abc.ABCMeta):
# class Traverser:
# class _PrintGraphVisitor(Visitor):
#   def __init__(self, parent_operation, value_index: int):
#   def __iter__(self):
#   def num_outputs(self) -> int:
#   def label(self) -> str:
#   def get_field_str(self, field_name: str) -> str:
#   def is_partitionable(self) -> bool:
#   def cache_coder(self) -> Optional[object]:
#   def __init__(self, operation_def, inputs):
#   def __repr__(self):
#   def operation_def(self):
#   def inputs(self):
#   def outputs(self):
# def apply_operation(operation_def_cls, *args, **kwargs):
# def apply_multi_output_operation(operation_def_cls, *args, **kwargs):
#   def validate_value(self, value):
#   def visit(self, operation_def, input_values):
#   def __init__(self, visitor: Visitor):
#   def visit_value_node(self, value_node: ValueNode):
#   def _maybe_visit_value_node(self, value_node: ValueNode):
#   def _visit_operation(self, operation: OperationNode):
# def _escape(line: str) -> str:
#   def __init__(self):
#   def get_dot_graph(self) -> pydot.Dot:
#   def visit(self, operation_def, input_nodes) -> Tuple[pydot.Node, ...]:
#   def validate_value(self, value: pydot.Node):
# def get_dot_graph(leaf_nodes: Collection[ValueNode]) -> pydot.Dot:
# 
# Path: tensorflow_transform/test_case.py
# def is_tf_api_version_1():
# def cross_named_parameters(*args):
#   def _cross_test_cases(parameters_list):
# def parameters(*testcases):
#   def wrapper(fn):
#     def to_arg_dict(testcase):
# def cross_parameters(*args):
# def _make_placeholder(tensor_spec):
# def _graph_function_handler(input_signature):
#   def wrapper(fn):
#     def _run_graph(*inputs):
# def _ragged_value_as_constant(value, dtype):
# def _wrap_as_constant(value, tensor_spec):
# def _eager_function_handler(input_signature):
#   def wrapper(fn):
#     def _run_eagerly(*inputs):  # pylint: disable=missing-docstring
# def _tf_function_function_handler(input_signature):
#   def wrapper(fn):
# def is_external_environment():
# def skip_if_external_environment(reason):
# def skip_if_not_tf2(reason):
# def cross_with_function_handlers(parameters_list):
#   def assertDataCloseOrEqual(self, a_data, b_data):
#   def _assertValuesCloseOrEqual(self, a_value, b_value, msg=None):
#   def AssertVocabularyContents(self, vocab_file_path, file_contents):
#   def WriteRenderedDotFile(self, dot_string, output_file=None):
#   def _NumpyArraysToLists(self, maybe_arrays):
#   def _SortedDicts(self, list_of_dicts):
#   def _SortedData(self, list_of_dicts_of_arrays):
# FUNCTION_HANDLERS = [
#     dict(testcase_name='graph',
#          function_handler=_graph_function_handler),
#     dict(testcase_name='eager',
#          function_handler=_eager_function_handler),
#     dict(testcase_name='tf_function',
#          function_handler=_tf_function_function_handler)
# ]
# class TransformTestCase(parameterized.TestCase, tf.test.TestCase):


# Path: tensorflow_transform/nodes_test.py
import tensorflow as tf
from tensorflow_transform import nodes
from tensorflow_transform import test_case
from tfx_bsl.types import tfx_namedtuple

        mock.call.validate_value('a'),
        mock.call.visit(_Concat('Concat[0]'), ('b', 'a')),
        mock.call.validate_value('ba'),
        mock.call.visit(_Constant('c', 'Constant[c]'), ()),
        mock.call.validate_value('c'),
        mock.call.visit(_Concat('Concat[1]'), ('ba', 'c')),
        mock.call.validate_value('bac'),
    ])

  def testTraverserOutputsNotATuple(self):
    a = nodes.apply_operation(_Constant, value='a', label='Constant[a]')

    mock_visitor = mock.MagicMock()
    mock_visitor.visit.side_effect = [42]

    with self.assertRaisesRegexp(
        ValueError, r'expected visitor to return a tuple, got'):
      nodes.Traverser(mock_visitor).visit_value_node(a)

  def testTraverserBadNumOutputs(self):
    a = nodes.apply_operation(_Constant, value='a', label='Constant[a]')
    mock_visitor = mock.MagicMock()
    mock_visitor.visit.side_effect = [('a', 'b')]

    with self.assertRaisesRegexp(
        ValueError, 'has 1 outputs but visitor returned 2 values: '):
      nodes.Traverser(mock_visitor).visit_value_node(a)

  def testTraverserCycle(self):
    a = nodes.apply_operation(_Constant, value='a', label='Constant[a]')

    x_0 = nodes.apply_operation(_Identity, a, label='Identity[0]')