import tensorflow as tf


from texar.tf.modules.regressors.xlnet_regressor import XLNetRegressor
from texar.tf.utils.test import pretrained_test

# pylint: disable=too-many-locals, no-member


class XLNetRegressorTest(tf.test.TestCase):
    """Tests :class:`~texar.tf.modules.XLNetRegressor` class.
    """

    @pretrained_test
    def test_model_loading(self):
        r"""Tests model loading functionality."""

        inputs = tf.placeholder(dtype=tf.int32, shape=[None, None])

        for pretrained_model_name in XLNetRegressor.available_checkpoints():
            regressor = XLNetRegressor(
                pretrained_model_name=pretrained_model_name)
            _ = regressor(inputs)

    def test_trainable_variables(self):
        """Tests the functionality of automatically collecting trainable
        variables.
        """
        inputs = tf.placeholder(dtype=tf.int32, shape=[None, None])

        # case 1
        hparams = {
