docstr: We keep this test for backward compatibility but it should be removed when `pad_to_max_length` will be deprecated
docstr_tok: ["We","keep","this","test","for","backward","compatibility","but","it","should","be","removed","when","`","pad_to_max_length","`","will","be","deprecated"]
code: def test_padding_to_max_length(self):
      """We keep this test for backward compatibility but it should be removed when `pad_to_max_length` will be deprecated"""
      tokenizers = self.get_tokenizers(do_lower_case=False)
      for tokenizer in tokenizers:
          with self.subTest(f"{tokenizer.__class__.__name__}"):
              nodes, xpaths = self.get_nodes_and_xpaths()
              padding_size = 10
  
              # check correct behaviour if no pad_token_id exists and add it eventually
              self._check_no_pad_token_padding(tokenizer, nodes)
  
              padding_idx = tokenizer.pad_token_id
  
              # Check that it correctly pads when a maximum length is specified along with the padding flag set to True
              tokenizer.padding_side = "right"
              encoded_sequence = tokenizer.encode(nodes, xpaths=xpaths)
              sequence_length = len(encoded_sequence)
              # FIXME: the next line should be padding(max_length) to avoid warning
              padded_sequence = tokenizer.encode(
                  nodes,
                  xpaths=xpaths,
                  max_length=sequence_length + padding_size,
                  pad_to_max_length=True,
              )
              padded_sequence_length = len(padded_sequence)
              assert (
                  sequence_length + padding_size
                  == padded_sequence_length
              )
              assert (
                  encoded_sequence + [padding_idx] * padding_size
                  == padded_sequence
              )
  
              # Check that nothing is done when a maximum length is not specified
              encoded_sequence = tokenizer.encode(nodes, xpaths=xpaths)
              sequence_length = len(encoded_sequence)
  
              tokenizer.padding_side = "right"
              padded_sequence_right = tokenizer.encode(
                  nodes, xpaths=xpaths, pad_to_max_length=True
              )
              padded_sequence_right_length = len(padded_sequence_right)
              assert sequence_length == padded_sequence_right_length
              assert encoded_sequence == padded_sequence_right
  
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 15 for calling the MarkupLMTokenizationTest obj's underlying member method code with example usage: obj.test_padding_to_max_length() without return types