code: def test_save_pretrained(self):
      if not self.test_slow_tokenizer:
          # as we don't have a slow version, we can't compare the outputs between slow and fast versions
          return
  
      self.tokenizers_list[0] = (
          self.rust_tokenizer_class,
          "hf-internal-testing/tiny-random-layoutxlm",
          {},
      )
      for tokenizer, pretrained_name, kwargs in self.tokenizers_list:
          with self.subTest(
              f"{tokenizer.__class__.__name__} ({pretrained_name})"
          ):
              tokenizer_r = self.rust_tokenizer_class.from_pretrained(
                  pretrained_name, **kwargs
              )
              tokenizer_p = self.tokenizer_class.from_pretrained(
                  pretrained_name, **kwargs
              )
  
              tmpdirname2 = tempfile.mkdtemp()
  
              tokenizer_r_files = tokenizer_r.save_pretrained(
                  tmpdirname2
              )
              tokenizer_p_files = tokenizer_p.save_pretrained(
                  tmpdirname2
              )
  
              # Checks it save with the same files + the tokenizer.json file for the fast one
              self.assertTrue(
                  any("tokenizer.json" in f for f in tokenizer_r_files)
              )
              tokenizer_r_files = tuple(
                  f
                  for f in tokenizer_r_files
                  if "tokenizer.json" not in f
              )
              self.assertSequenceEqual(
                  tokenizer_r_files, tokenizer_p_files
              )
  
              # Checks everything loads correctly in the same way
              tokenizer_rp = tokenizer_r.from_pretrained(tmpdirname2)
              tokenizer_pp = tokenizer_p.from_pretrained(tmpdirname2)
  
              # Check special tokens are set accordingly on Rust and Python
              for key in tokenizer_pp.special_tokens_map:
                  self.assertTrue(hasattr(tokenizer_rp, key))
                  # self.assertEqual(getattr(tokenizer_rp, key), getattr(tokenizer_pp, key))
                  # self.assertEqual(getattr(tokenizer_rp, key + "_id"), getattr(tokenizer_pp, key + "_id"))
  
              shutil.rmtree(tmpdirname2)
  
              # Save tokenizer rust, legacy_format=True
              tmpdirname2 = tempfile.mkdtemp()
  
              tokenizer_r_files = tokenizer_r.save_pretrained(
                  tmpdirname2, legacy_format=True
              )
              tokenizer_p_files = tokenizer_p.save_pretrained(
                  tmpdirname2
              )
  
              # Checks it save with the same files
              self.assertSequenceEqual(
                  tokenizer_r_files, tokenizer_p_files
              )
  
              # Checks everything loads correctly in the same way
              tokenizer_rp = tokenizer_r.from_pretrained(tmpdirname2)
              tokenizer_pp = tokenizer_p.from_pretrained(tmpdirname2)
  
              # Check special tokens are set accordingly on Rust and Python
              for key in tokenizer_pp.special_tokens_map:
                  self.assertTrue(hasattr(tokenizer_rp, key))
  
              shutil.rmtree(tmpdirname2)
  
              # Save tokenizer rust, legacy_format=False
              tmpdirname2 = tempfile.mkdtemp()
  
              tokenizer_r_files = tokenizer_r.save_pretrained(
                  tmpdirname2, legacy_format=False
              )
              tokenizer_p_files = tokenizer_p.save_pretrained(
                  tmpdirname2
              )
  
              # Checks it saved the tokenizer.json file
              self.assertTrue(
                  any("tokenizer.json" in f for f in tokenizer_r_files)
              )
  
              # Checks everything loads correctly in the same way
              tokenizer_rp = tokenizer_r.from_pretrained(tmpdirname2)
              tokenizer_pp = tokenizer_p.from_pretrained(tmpdirname2)
  
              # Check special tokens are set accordingly on Rust and Python
              for key in tokenizer_pp.special_tokens_map:
                  self.assertTrue(hasattr(tokenizer_rp, key))
  
              shutil.rmtree(tmpdirname2)
  
imports: import inspect
  import shutil
  import tempfile
  import unittest
  from typing import List
  from transformers import AddedToken, LayoutXLMTokenizerFast, SpecialTokensMixin, is_tf_available, is_torch_available, logging
  from transformers.models.layoutxlm.tokenization_layoutxlm import LayoutXLMTokenizer
  from transformers.testing_utils import get_tests_dir, is_pt_tf_cross_test, require_pandas, require_scatter, require_sentencepiece, require_tokenizers, require_torch, slow
  from ...test_tokenization_common import SMALL_TRAINING_CORPUS, TokenizerTesterMixin, filter_non_english, merge_model_tokenizer_mappings
label_desc: Use image node_id 48 for calling the LayoutXLMTokenizationTest obj's underlying member method code with example usage: obj.test_save_pretrained() without return types