code: def test_graph():
      """Make a simple graph"""
      #
      # The skeleton looks something like this:
      #
      #   .   .
      #    . .
      #     .
      #     .
      i, j = numpy.mgrid[-10:11, -10:11]
      skel = (i < 0) & (numpy.abs(i) == numpy.abs(j))
      skel[(i >= 0) & (j == 0)] = True
      #
      # Put a single label at the bottom
      #
      labels = numpy.zeros(skel.shape, int)
      labels[(i > 8) & (numpy.abs(j) < 2)] = 1
      numpy.random.seed(31)
      intensity = numpy.random.uniform(size=skel.shape)
      workspace, module = make_workspace(
          labels, skel, intensity_image=intensity, wants_graph=True
      )
      module.prepare_run(workspace)
      module.run(workspace)
      edge_graph = read_graph_file(EDGE_FILE)
      vertex_graph = read_graph_file(VERTEX_FILE)
      vidx = numpy.lexsort((vertex_graph["j"], vertex_graph["i"]))
      #
      # There should be two vertices at the bottom of the array - these
      # are bogus artifacts of the object hitting the edge of the image
      #
      for vidxx in vidx[-2:]:
          assert vertex_graph["i"][vidxx] == 20
      vidx = vidx[:-2]
  
      expected_vertices = ((0, 0), (0, 20), (10, 10), (17, 10))
      assert len(vidx) == len(expected_vertices)
      for idx, v in enumerate(expected_vertices):
          vv = vertex_graph[vidx[idx]]
          assert vv["i"] == v[0]
          assert vv["j"] == v[1]
  
      #
      # Get rid of edges to the bogus vertices
      #
      for v in ("v1", "v2"):
          edge_graph = edge_graph[
              vertex_graph["i"][edge_graph[v] - 1] != 20
          ]
  
      eidx = numpy.lexsort(
          (
              vertex_graph["j"][edge_graph["v1"] - 1],
              vertex_graph["i"][edge_graph["v1"] - 1],
              vertex_graph["j"][edge_graph["v2"] - 1],
              vertex_graph["i"][edge_graph["v2"] - 1],
          )
      )
      expected_edges = (
          (
              (0, 0),
              (10, 10),
              11,
              numpy.sum(intensity[(i <= 0) & (j <= 0) & skel]),
          ),
          (
              (0, 20),
              (10, 10),
              11,
              numpy.sum(intensity[(i <= 0) & (j >= 0) & skel]),
          ),
          (
              (10, 10),
              (17, 10),
              8,
              numpy.sum(intensity[(i >= 0) & (i <= 7) & skel]),
          ),
      )
      for i, (v1, v2, length, total_intensity) in enumerate(
          expected_edges
      ):
          ee = edge_graph[eidx[i]]
          for ve, v in ((v1, ee["v1"]), (v2, ee["v2"])):
              assert ve[0] == vertex_graph["i"][v - 1]
              assert ve[1] == vertex_graph["j"][v - 1]
          assert length == ee["length"]
          assert (
              round(abs(total_intensity - ee["total_intensity"]), 4)
              == 0
          )
  
imports: import os
  import tempfile
  import traceback
  import numpy
  import six.moves
  import cellprofiler_core.image
  import cellprofiler_core.measurement
  from cellprofiler_core.constants.measurement import GROUP_NUMBER, GROUP_INDEX, COLTYPE_FLOAT, COLTYPE_INTEGER
  import cellprofiler.modules.measureobjectskeleton
  import cellprofiler_core.object
  import cellprofiler_core.pipeline
  import cellprofiler_core.preferences
  import cellprofiler_core.setting
  import cellprofiler_core.workspace
  import tests.frontend.modules
label_desc: Use image node_id 14 for calling a global function with example usage: test_graph() without return types