code: def test_log_parser():
      """Test GLIR log parsing"""
      glir_file = tempfile.TemporaryFile(mode="r+")
  
      config.update(glir_file=glir_file)
      with Canvas() as c:
          c.context.set_clear_color("white")
          c.context.clear()
  
      glir_file.seek(0)
      lines = glir_file.read().split(",\n")
  
      assert lines[0][0] == "["
      lines[0] = lines[0][1:]
  
      assert lines[-1][-1] == "]"
      lines[-1] = lines[-1][:-1]
  
      i = 0
  
      # The FBO argument may be anything based on the backend.
      expected = json.dumps(["CURRENT", 0, 1])
      assert len(lines[i]) >= len(expected)
      expected = expected.split("1")
      assert lines[i].startswith(expected[0])
      assert lines[i].endswith(expected[1])
      assert (
          int(lines[i][len(expected[0]) : -len(expected[1])])
          is not None
      )
  
      # The 'CURRENT' command may have been called multiple times
      while lines[i].startswith('["CURRENT",'):
          i += 1
          if lines[i] == json.dumps(
              ["FUNC", "colorMask", False, False, False, True]
          ):
              # Qt workaround, see #2040
              i += 4
  
      assert lines[i] == json.dumps(
          ["FUNC", "clearColor", 1.0, 1.0, 1.0, 1.0]
      )
      i += 1
      assert lines[i] == json.dumps(["FUNC", "clear", 17664])
      i += 1
      assert lines[i] == json.dumps(["FUNC", "finish"])
      i += 1
  
      config.update(glir_file="")
      glir_file.close()
  
file_path: vispy/vispy/gloo/tests/test_glir.py
imports: import json
  import tempfile
  from unittest import mock
  from vispy import config
  from vispy.app import Canvas
  from vispy.gloo import glir
  from vispy.testing import requires_application, requires_pyopengl, run_tests_if_main
  import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: test_log_parser() without return types