code: def test_local_versioning(self):
      tokenizer = AutoTokenizer.from_pretrained("bert-base-cased")
      json_tokenizer = json.loads(tokenizer._tokenizer.to_str())
      json_tokenizer["model"]["vocab"]["huggingface"] = len(tokenizer)
  
      with tempfile.TemporaryDirectory() as tmp_dir:
          # Hack to save this in the tokenizer_config.json
          tokenizer.init_kwargs["fast_tokenizer_files"] = [
              "tokenizer.4.0.0.json"
          ]
          tokenizer.save_pretrained(tmp_dir)
          json.dump(
              json_tokenizer,
              open(os.path.join(tmp_dir, "tokenizer.4.0.0.json"), "w"),
          )
  
          # This should pick the new tokenizer file as the version of Transformers is > 4.0.0
          new_tokenizer = AutoTokenizer.from_pretrained(tmp_dir)
          self.assertEqual(len(new_tokenizer), len(tokenizer) + 1)
          json_tokenizer = json.loads(new_tokenizer._tokenizer.to_str())
          self.assertIn("huggingface", json_tokenizer["model"]["vocab"])
  
          # Will need to be adjusted if we reach v42 and this test is still here.
          # Should pick the old tokenizer file as the version of Transformers is < 4.0.0
          shutil.move(
              os.path.join(tmp_dir, "tokenizer.4.0.0.json"),
              os.path.join(tmp_dir, "tokenizer.42.0.0.json"),
          )
          tokenizer.init_kwargs["fast_tokenizer_files"] = [
              "tokenizer.42.0.0.json"
          ]
          tokenizer.save_pretrained(tmp_dir)
          new_tokenizer = AutoTokenizer.from_pretrained(tmp_dir)
          self.assertEqual(len(new_tokenizer), len(tokenizer))
          json_tokenizer = json.loads(new_tokenizer._tokenizer.to_str())
          self.assertNotIn(
              "huggingface", json_tokenizer["model"]["vocab"]
          )
  
imports: import concurrent.futures
  import json
  import os
  import shutil
  import tempfile
  import unittest
  from transformers import AutoTokenizer, PreTrainedTokenizerFast
  from transformers.testing_utils import require_tokenizers
  from ..test_tokenization_common import TokenizerTesterMixin
label_desc: Use image node_id 1 for calling the TokenizerVersioningTest obj's underlying member method code with example usage: obj.test_local_versioning() without return types