code: def test_temp_dir():
      fn = "test_temp_dir"
      if os.path.exists(fn):
          print("Path %s exists, not running test_temp_dir()" % fn)
          return
      try:
          assert not os.path.exists(fn)
          with temp_dir(fn):
              assert os.path.exists(fn)
          assert os.path.exists(fn)
          os.rmdir(fn)
  
          assert not os.path.exists(fn)
          with temp_dir(fn, erase_after=True):
              assert os.path.exists(fn)
          assert not os.path.exists(fn)
      finally:
          if os.path.isdir(fn):
              os.rmdir(fn)
  
file_path: hyperopt/hyperopt/tests/unit/test_utils.py
imports: import numpy
  from nose.tools import raises, eq_
  import shutil
  import os
  from hyperopt.utils import fast_isin
  from hyperopt.utils import get_most_recent_inds
  from hyperopt.utils import temp_dir, working_dir, get_closest_dir, path_split_all
label_desc: Use image node_id 4 for calling a global function with example usage: test_temp_dir() without return types