code: def test_modulepickling_change_cache_dir(tmpdir):
      """
      ParserPickling should not save old cache when cache_directory is changed.
  
      See: `#168 <https://github.com/davidhalter/jedi/pull/168>`_
      """
      dir_1 = Path(str(tmpdir.mkdir("first")))
      dir_2 = Path(str(tmpdir.mkdir("second")))
  
      item_1 = _NodeCacheItem("bla", [])
      item_2 = _NodeCacheItem("bla", [])
      path_1 = Path("fake path 1")
      path_2 = Path("fake path 2")
  
      hashed_grammar = load_grammar()._hashed
      _save_to_file_system(
          hashed_grammar, path_1, item_1, cache_path=dir_1
      )
      parser_cache.clear()
      cached = load_stored_item(
          hashed_grammar, path_1, item_1, cache_path=dir_1
      )
      assert cached == item_1.node
  
      _save_to_file_system(
          hashed_grammar, path_2, item_2, cache_path=dir_2
      )
      cached = load_stored_item(
          hashed_grammar, path_1, item_1, cache_path=dir_2
      )
      assert cached is None
  
imports: import os
  import pytest
  import time
  from pathlib import Path
  from parso.cache import _CACHED_FILE_MAXIMUM_SURVIVAL, _VERSION_TAG, _get_cache_clear_lock_path, _get_hashed_path, _load_from_file_system, _NodeCacheItem, _remove_cache_and_update_lock, _save_to_file_system, load_module, parser_cache, try_to_save_module
  from parso._compatibility import is_pypy
  from parso import load_grammar
  from parso import cache
  from parso import file_io
  from parso import parse
label_desc: Use image node_id 2 for calling a global function with example usage: test_modulepickling_change_cache_dir(tmpdir) without return types