# Copyright 2021 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tests for tfx.examples.ranking.struct2tensor_parsing_utils."""

import itertools
import unittest

import tensorflow as tf
from tfx.examples.ranking import struct2tensor_parsing_utils

from google.protobuf import text_format
from tensorflow_serving.apis import input_pb2


_ELWCS = [
    text_format.Parse(
        """
context {
  features {
    feature {
      key: "ctx.int"  # dot in the feature name is intended.
      value {
        int64_list {
          value: [1, 2]
        }
      }
    }
    feature {
      key: "ctx.float"
      value {
        float_list {
          value: [1.0, 2.0]
        }
      }
    }
    feature {
      key: "ctx.bytes"
      value {
        bytes_list {
          value: []
        }
      }
    }
  }
}
examples {
  features {
    feature {
      key: "example_int"
      value {
        int64_list {
          value: [11]
        }
      }
    }
    feature {
      key: "example_float"
      value {
        float_list {
          value: [11.0, 12.0]
        }
      }
    }
    feature {
      key: "example_bytes"