code: def test_tilde_in_tempfilename(tmp_path):
      # Tilde ~ in the tempdir path (e.g. TMPDIR, TMP or TEMP on windows
      # when the username is very long and windows uses a short name) breaks
      # latex before https://github.com/matplotlib/matplotlib/pull/5928
      base_tempdir = tmp_path / "short-1"
      base_tempdir.mkdir()
      # Change the path for new tempdirs, which is used internally by the ps
      # backend to write a file.
      with cbook._setattr_cm(tempfile, tempdir=str(base_tempdir)):
          # usetex results in the latex call, which does not like the ~
          mpl.rcParams["text.usetex"] = True
          plt.plot([1, 2, 3, 4])
          plt.xlabel(r"\textbf{time} (s)")
          # use the PS backend to write the file...
          plt.savefig(base_tempdir / "tex_demo.eps", format="ps")
  
imports: from collections import Counter
  from pathlib import Path
  import io
  import re
  import tempfile
  import numpy
  import pytest
  from matplotlib import cbook, path, patheffects, font_manager
  from matplotlib.figure import Figure
  from matplotlib.patches import Ellipse
  from matplotlib.testing._markers import needs_ghostscript, needs_usetex
  from matplotlib.testing.decorators import check_figures_equal, image_comparison
  import matplotlib
  import matplotlib.collections
  import matplotlib.colors
  import matplotlib.pyplot
label_desc: Use image node_id 3 for calling a global function with example usage: test_tilde_in_tempfilename(tmp_path) without return types