code: def test_training_new_tokenizer_with_special_tokens_change(self):
      # This feature only exists for fast tokenizers
      if not self.test_rust_tokenizer:
          return
  
      tokenizer = self.get_rust_tokenizer()
      # Test with a special tokens map
      class_signature = inspect.signature(tokenizer.__class__)
      if "cls_token" in class_signature.parameters:
          new_tokenizer = tokenizer.train_new_from_iterator(
              SMALL_TRAINING_CORPUS,
              100,
              special_tokens_map={tokenizer.cls_token: "<cls>"},
          )
          cls_id = new_tokenizer.get_vocab()["<cls>"]
          self.assertEqual(new_tokenizer.cls_token, "<cls>")
          self.assertEqual(new_tokenizer.cls_token_id, cls_id)
  
      # Create a new mapping from the special tokens defined in the original tokenizer
      special_tokens_list = (
          SpecialTokensMixin.SPECIAL_TOKENS_ATTRIBUTES.copy()
      )
      special_tokens_list.remove("additional_special_tokens")
      special_tokens_map = {}
      for token in special_tokens_list:
          # Get the private one to avoid unnecessary warnings.
          if getattr(tokenizer, f"_{token}") is not None:
              special_token = getattr(tokenizer, token)
              special_tokens_map[special_token] = f"{special_token}a"
  
      # Train new tokenizer
      new_tokenizer = tokenizer.train_new_from_iterator(
          SMALL_TRAINING_CORPUS,
          100,
          special_tokens_map=special_tokens_map,
      )
  
      # Check the changes
      for token in special_tokens_list:
          # Get the private one to avoid unnecessary warnings.
          if getattr(tokenizer, f"_{token}") is None:
              continue
          special_token = getattr(tokenizer, token)
          if special_token in special_tokens_map:
              new_special_token = getattr(new_tokenizer, token)
              self.assertEqual(
                  special_tokens_map[special_token], new_special_token
              )
  
              new_id = new_tokenizer.get_vocab()[new_special_token]
              self.assertEqual(
                  getattr(new_tokenizer, f"{token}_id"), new_id
              )
  
      # Check if the AddedToken / string format has been kept
      for special_token in tokenizer.all_special_tokens_extended:
          if (
              isinstance(special_token, AddedToken)
              and special_token.content not in special_tokens_map
          ):
              # The special token must appear identically in the list of the new tokenizer.
              self.assertTrue(
                  special_token
                  in new_tokenizer.all_special_tokens_extended,
                  f"'{special_token}' should be in {new_tokenizer.all_special_tokens_extended}",
              )
          elif isinstance(special_token, AddedToken):
              # The special token must appear in the list of the new tokenizer as an object of type AddedToken with
              # the same parameters as the old AddedToken except the content that the user has requested to change.
              special_token_str = special_token.content
              new_special_token_str = special_tokens_map[
                  special_token_str
              ]
  
              find = False
              for (
                  candidate
              ) in new_tokenizer.all_special_tokens_extended:
                  if (
                      isinstance(candidate, AddedToken)
                      and candidate.content == new_special_token_str
                      and candidate.lstrip == special_token.lstrip
                      and candidate.rstrip == special_token.rstrip
                      and candidate.normalized
                      == special_token.normalized
                      and candidate.single_word
                      == special_token.single_word
                  ):
                      find = True
                      break
              self.assertTrue(
                  find,
                  f"'{new_special_token_str}' doesn't appear in the list "
                  f"'{new_tokenizer.all_special_tokens_extended}' as an AddedToken with the same parameters as "
                  f"'{special_token}' in the list {tokenizer.all_special_tokens_extended}",
              )
          elif special_token not in special_tokens_map:
              # The special token must appear identically in the list of the new tokenizer.
              self.assertTrue(
                  special_token
                  in new_tokenizer.all_special_tokens_extended,
                  f"'{special_token}' should be in {new_tokenizer.all_special_tokens_extended}",
              )
  
          else:
              # The special token must appear in the list of the new tokenizer as an object of type string.
              self.assertTrue(
                  special_tokens_map[special_token]
                  in new_tokenizer.all_special_tokens_extended
              )
  
      # Test we can use the new tokenizer with something not seen during training
      nodes = [["this", "is"], ["hello", "🤗"]]
      xpaths = [["html/body"] * 2, ["html/body"] * 2]
      inputs = new_tokenizer(nodes, xpaths=xpaths)
      self.assertEqual(len(inputs["input_ids"]), 2)
      decoded_input = new_tokenizer.decode(
          inputs["input_ids"][0], skip_special_tokens=True
      )
      expected_result = "thisis"  # same as line 1399
  
      if tokenizer.backend_tokenizer.normalizer is not None:
          expected_result = (
              tokenizer.backend_tokenizer.normalizer.normalize_str(
                  expected_result
              )
          )
      self.assertEqual(expected_result, decoded_input)
  
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 40 for calling the MarkupLMTokenizationTest obj's underlying member method code with example usage: obj.test_training_new_tokenizer_with_special_tokens_change() without return types