code: def test_mesh_shading_filter(shading):
      size = (45, 40)
      with TestingCanvas(size=size, bgcolor="k") as c:
          v = c.central_widget.add_view(border_width=0)
          v.camera = "arcball"
          mdata = create_sphere(20, 30, radius=1)
          mesh = scene.visuals.Mesh(
              meshdata=mdata,
              shading=shading,
              color=(0.2, 0.3, 0.7, 1.0),
          )
          v.add(mesh)
  
          rendered = c.render()[..., 0]  # R channel only
          if shading in ("flat", "smooth"):
              # there should be a gradient, not solid colors
              assert np.unique(rendered).size >= 28
              # sphere/circle is "dark" on the right and gets brighter as you
              # move to the left, then hits a bright spot and decreases after
              invest_row = rendered[34].astype(np.float64)
              # overall, we should be increasing brightness up to a "bright spot"
              assert (np.diff(invest_row[34:60]) <= 0).all()
          else:
              assert np.unique(rendered).size == 2
  
file_path: vispy/vispy/visuals/tests/test_mesh.py
imports: import numpy
  from vispy import scene
  from vispy.color import Color
  from vispy.geometry import create_cube, create_sphere
  from vispy.testing import TestingCanvas, requires_application, run_tests_if_main, requires_pyopengl
  from vispy.visuals.filters import ShadingFilter, WireframeFilter
  from vispy.visuals.filters.mesh import _as_rgba
  import pytest
label_desc: Use image node_id 4 for calling a global function with example usage: test_mesh_shading_filter(shading) without return types