def METHOD_NAME(self, sparse):
    inputs = tf.constant([0, 1, 2])
    outputs = preprocessing_utils.encode_categorical_inputs(
        inputs, output_mode="one_hot", depth=4, sparse=sparse
    )
    if sparse:
        outputs = tf.sparse.to_dense(outputs)
    self.assertAllEqual([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0]], outputs)