# Path: tensorflow_decision_forests/component/py_tree/dataspec.py
# OUT_OF_DICTIONARY = "<OOD>"
# class SimpleColumnSpec(NamedTuple):
#   def __repr__(self):
# def make_simple_column_spec(dataspec: data_spec_pb2.DataSpecification,
#                             col_idx: int) -> SimpleColumnSpec:
# def categorical_value_idx_to_value(column_spec: data_spec_pb2.Column,
#                                    value_idx: int) -> Union[int, str]:
# def categorical_column_dictionary_to_list(
#     column_spec: data_spec_pb2.Column) -> List[str]:
# def label_value_idx_to_value(column_spec: data_spec_pb2.Column,
#                              value_idx: int) -> Union[int, str]:
# def discretized_numerical_to_numerical(column_spec: data_spec_pb2.Column,
#                                        value: int) -> float:
# def column_name_to_column_idx(name: str,
#                               dataspec: data_spec_pb2.DataSpecification) -> int:


import math
import tensorflow as tf
from absl.testing import parameterized
from tensorflow_decision_forests.component.py_tree import dataspec as dataspec_lib
from yggdrasil_decision_forests.dataset import data_spec_pb2

  f1 = dataspec.columns.add()
  f1.name = "f1"
  f1.type = data_spec_pb2.ColumnType.NUMERICAL

  f2 = dataspec.columns.add()
  f2.name = "f2"
  f2.type = data_spec_pb2.ColumnType.CATEGORICAL
  f2.categorical.number_of_unique_values = 3
  f2.categorical.items["<OOD>"].index = 0
  f2.categorical.items["x"].index = 1
  f2.categorical.items["y"].index = 2

  f3 = dataspec.columns.add()
  f3.name = "f3"
  f3.type = data_spec_pb2.ColumnType.CATEGORICAL
  f3.categorical.number_of_unique_values = 3
  f3.categorical.is_already_integerized = True

  f4 = dataspec.columns.add()
  f4.name = "f4"
  f4.type = data_spec_pb2.ColumnType.DISCRETIZED_NUMERICAL
  f4.discretized_numerical.boundaries[:] = [0, 1, 2]
  return dataspec


class DataspecTest(parameterized.TestCase, tf.test.TestCase):

  def test_make_simple_column_spec(self):
    self.assertEqual(

# Path: tensorflow_decision_forests/component/py_tree/dataspec.py
# OUT_OF_DICTIONARY = "<OOD>"
# class SimpleColumnSpec(NamedTuple):
#   def __repr__(self):
# def make_simple_column_spec(dataspec: data_spec_pb2.DataSpecification,
#                             col_idx: int) -> SimpleColumnSpec:
# def categorical_value_idx_to_value(column_spec: data_spec_pb2.Column,
#                                    value_idx: int) -> Union[int, str]:
# def categorical_column_dictionary_to_list(
#     column_spec: data_spec_pb2.Column) -> List[str]:
# def label_value_idx_to_value(column_spec: data_spec_pb2.Column,
#                              value_idx: int) -> Union[int, str]:
# def discretized_numerical_to_numerical(column_spec: data_spec_pb2.Column,
#                                        value: int) -> float:
# def column_name_to_column_idx(name: str,
#                               dataspec: data_spec_pb2.DataSpecification) -> int:


# Path: tensorflow_decision_forests/component/py_tree/dataspec_test.py
import math
import tensorflow as tf
from absl.testing import parameterized
from tensorflow_decision_forests.component.py_tree import dataspec as dataspec_lib
from yggdrasil_decision_forests.dataset import data_spec_pb2


  f1 = dataspec.columns.add()
  f1.name = "f1"
  f1.type = data_spec_pb2.ColumnType.NUMERICAL

  f2 = dataspec.columns.add()
  f2.name = "f2"
  f2.type = data_spec_pb2.ColumnType.CATEGORICAL
  f2.categorical.number_of_unique_values = 3
  f2.categorical.items["<OOD>"].index = 0
  f2.categorical.items["x"].index = 1
  f2.categorical.items["y"].index = 2

  f3 = dataspec.columns.add()
  f3.name = "f3"
  f3.type = data_spec_pb2.ColumnType.CATEGORICAL
  f3.categorical.number_of_unique_values = 3
  f3.categorical.is_already_integerized = True

  f4 = dataspec.columns.add()
  f4.name = "f4"
  f4.type = data_spec_pb2.ColumnType.DISCRETIZED_NUMERICAL
  f4.discretized_numerical.boundaries[:] = [0, 1, 2]
  return dataspec


class DataspecTest(parameterized.TestCase, tf.test.TestCase):

  def test_make_simple_column_spec(self):
    self.assertEqual(

        dataspec_lib.make_simple_column_spec(toy_dataspec(), 0),