code: def test_encode_text(self):
      tokenizer = GPT2Tokenizer.load(
          self.tmp_dir.name, self.special_tokens_map
      )
  
      text_1 = "lower newer"
  
      text_1_ids = tokenizer.map_text_to_id(text_1)
  
      input_ids, seq_len = tokenizer.encode_text(
          text=text_1, max_seq_length=10
      )
  
      bos_token_id = tokenizer.map_token_to_id(tokenizer.bos_token)
      eos_token_id = tokenizer.map_token_to_id(tokenizer.eos_token)
      pad_token_id = tokenizer.map_token_to_id(tokenizer.pad_token)
  
      self.assertListEqual(
          input_ids,
          [bos_token_id] + text_1_ids + [eos_token_id] + [pad_token_id],
      )
      self.assertEqual(seq_len, 9)
  
file_path: texar/tests/data/tokenizers/gpt2_tokenizer_test.py
imports: import json
  import os
  import pickle
  import tempfile
  import tensorflow
  from texar.tf.data.tokenizers.gpt2_tokenizer import GPT2Tokenizer
  from texar.tf.utils.test import pretrained_test
label_desc: Use image node_id 10 for calling the GPT2TokenizerTest obj's underlying member method code with example usage: obj.test_encode_text() without return types