code: def test_maximum_encoding_length_single_input(self):
      tokenizers = self.get_tokenizers(
          do_lower_case=False, model_max_length=100
      )
      for tokenizer in tokenizers:
          with self.subTest(f"{tokenizer.__class__.__name__}"):
              seq_0, xpaths_0, ids = self.get_clean_sequence(
                  tokenizer, max_length=20
              )
  
              sequence = tokenizer(
                  seq_0, xpaths=xpaths_0, add_special_tokens=False
              )
              total_length = len(sequence["input_ids"])
  
              self.assertGreater(
                  total_length,
                  4,
                  "Issue with the testing sequence, please update it it's too short",
              )
  
              # Test with max model input length
              model_max_length = tokenizer.model_max_length
              self.assertEqual(model_max_length, 100)
              seq_1 = seq_0 * model_max_length
              xpaths_1 = xpaths_0 * model_max_length
              sequence1 = tokenizer(
                  seq_1, xpaths=xpaths_1, add_special_tokens=False
              )
              total_length1 = len(sequence1["input_ids"])
              self.assertGreater(
                  total_length1,
                  model_max_length,
                  "Issue with the testing sequence, please update it it's too short",
              )
  
              # Simple
              padding_strategies = (
                  [False, True, "longest"]
                  if tokenizer.pad_token and tokenizer.pad_token_id >= 0
                  else [False]
              )
              for padding_state in padding_strategies:
                  with self.subTest(f"Padding: {padding_state}"):
                      for truncation_state in [
                          True,
                          "longest_first",
                          "only_first",
                      ]:
                          with self.subTest(
                              f"Truncation: {truncation_state}"
                          ):
                              output = tokenizer(
                                  seq_1,
                                  xpaths=xpaths_1,
                                  padding=padding_state,
                                  truncation=truncation_state,
                              )
                              self.assertEqual(
                                  len(output["input_ids"]),
                                  model_max_length,
                              )
                              self.assertEqual(
                                  len(output["xpath_tags_seq"]),
                                  model_max_length,
                              )
                              self.assertEqual(
                                  len(output["xpath_subs_seq"]),
                                  model_max_length,
                              )
  
                              output = tokenizer(
                                  [seq_1],
                                  xpaths=[xpaths_1],
                                  padding=padding_state,
                                  truncation=truncation_state,
                              )
                              self.assertEqual(
                                  len(output["input_ids"][0]),
                                  model_max_length,
                              )
                              self.assertEqual(
                                  len(output["xpath_tags_seq"][0]),
                                  model_max_length,
                              )
                              self.assertEqual(
                                  len(output["xpath_subs_seq"][0]),
                                  model_max_length,
                              )
  
                      # Simple with no truncation
                      # Reset warnings
                      tokenizer.deprecation_warnings = {}
                      with self.assertLogs(
                          "transformers", level="WARNING"
                      ) as cm:
                          output = tokenizer(
                              seq_1,
                              xpaths=xpaths_1,
                              padding=padding_state,
                              truncation=False,
                          )
                          self.assertNotEqual(
                              len(output["input_ids"]), model_max_length
                          )
                          self.assertNotEqual(
                              len(output["xpath_tags_seq"]),
                              model_max_length,
                          )
                          self.assertNotEqual(
                              len(output["xpath_subs_seq"]),
                              model_max_length,
                          )
                      self.assertEqual(len(cm.records), 1)
                      self.assertTrue(
                          cm.records[0].message.startswith(
                              "Token indices sequence length is longer than the specified maximum sequence length"
                              " for this model"
                          )
                      )
  
                      tokenizer.deprecation_warnings = {}
                      with self.assertLogs(
                          "transformers", level="WARNING"
                      ) as cm:
                          output = tokenizer(
                              [seq_1],
                              xpaths=[xpaths_1],
                              padding=padding_state,
                              truncation=False,
                          )
                          self.assertNotEqual(
                              len(output["input_ids"][0]),
                              model_max_length,
                          )
                          self.assertNotEqual(
                              len(output["xpath_tags_seq"][0]),
                              model_max_length,
                          )
                          self.assertNotEqual(
                              len(output["xpath_subs_seq"][0]),
                              model_max_length,
                          )
                      self.assertEqual(len(cm.records), 1)
                      self.assertTrue(
                          cm.records[0].message.startswith(
                              "Token indices sequence length is longer than the specified maximum sequence length"
                              " for this model"
                          )
                      )
              # Check the order of Sequence of input ids, overflowing tokens, xpath_tags_seq and xpath_subs_seq sequence with truncation
              stride = 2
              information = tokenizer(
                  seq_0,
                  xpaths=xpaths_0,
                  max_length=total_length - 2,
                  add_special_tokens=False,
                  stride=stride,
                  truncation=True,
                  return_overflowing_tokens=True,
              )
  
              # Overflowing tokens are handled quite differently in slow and fast tokenizers
              if isinstance(tokenizer, MarkupLMTokenizerFast):
                  truncated_sequence = information["input_ids"][0]
                  overflowing_tokens = information["input_ids"][1]
                  xpath_tags_seq = information["xpath_tags_seq"][0]
                  overflowing_xpath_tags_seq = information[
                      "xpath_tags_seq"
                  ][1]
                  self.assertEqual(len(information["input_ids"]), 2)
  
                  self.assertEqual(
                      len(truncated_sequence), total_length - 2
                  )
                  self.assertEqual(
                      truncated_sequence, sequence["input_ids"][:-2]
                  )
  
                  self.assertEqual(len(overflowing_tokens), 2 + stride)
                  self.assertEqual(
                      overflowing_tokens,
                      sequence["input_ids"][-(2 + stride) :],
                  )
  
                  self.assertEqual(
                      xpath_tags_seq, sequence["xpath_tags_seq"][:-2]
                  )
                  self.assertEqual(
                      overflowing_xpath_tags_seq,
                      sequence["xpath_tags_seq"][-(2 + stride) :],
                  )
              else:
                  truncated_sequence = information["input_ids"]
                  overflowing_tokens = information["overflowing_tokens"]
                  xpath_tags_seq = information["xpath_tags_seq"]
                  overflowing_xpath_tags_seq = information[
                      "overflowing_xpath_tags_seq"
                  ]
                  self.assertEqual(
                      len(truncated_sequence), total_length - 2
                  )
                  self.assertEqual(
                      truncated_sequence, sequence["input_ids"][:-2]
                  )
  
                  self.assertEqual(len(overflowing_tokens), 2 + stride)
                  self.assertEqual(
                      overflowing_tokens,
                      sequence["input_ids"][-(2 + stride) :],
                  )
                  self.assertEqual(
                      xpath_tags_seq, sequence["xpath_tags_seq"][:-2]
                  )
                  self.assertEqual(
                      overflowing_xpath_tags_seq,
                      sequence["xpath_tags_seq"][-(2 + stride) :],
                  )
  
imports: import inspect
  import json
  import os
  import re
  import shutil
  import tempfile
  import unittest
  from typing import List
  from transformers import AddedToken, MarkupLMTokenizerFast, SpecialTokensMixin, is_tf_available, is_torch_available, logging
  from transformers.models.markuplm.tokenization_markuplm import VOCAB_FILES_NAMES, MarkupLMTokenizer
  from transformers.testing_utils import is_pt_tf_cross_test, require_tokenizers, require_torch, slow
  from ...test_tokenization_common import SMALL_TRAINING_CORPUS, TokenizerTesterMixin, merge_model_tokenizer_mappings
label_desc: Use image node_id 47 for calling the MarkupLMTokenizationTest obj's underlying member method code with example usage: obj.test_maximum_encoding_length_single_input() without return types