code: def test_fuse():
      fuse = fuse2  # tests both `fuse` and `fuse_linear`
      d = {
          "w": (inc, "x"),
          "x": (inc, "y"),
          "y": (inc, "z"),
          "z": (add, "a", "b"),
          "a": 1,
          "b": 2,
      }
      assert fuse(d, rename_keys=False) == with_deps(
          {"w": (inc, (inc, (inc, (add, "a", "b")))), "a": 1, "b": 2}
      )
      assert fuse(d, rename_keys=True) == with_deps(
          {
              "z-y-x-w": (inc, (inc, (inc, (add, "a", "b")))),
              "a": 1,
              "b": 2,
              "w": "z-y-x-w",
          }
      )
  
      d = {
          "NEW": (inc, "y"),
          "w": (inc, "x"),
          "x": (inc, "y"),
          "y": (inc, "z"),
          "z": (add, "a", "b"),
          "a": 1,
          "b": 2,
      }
      assert fuse(d, rename_keys=False) == with_deps(
          {
              "NEW": (inc, "y"),
              "w": (inc, (inc, "y")),
              "y": (inc, (add, "a", "b")),
              "a": 1,
              "b": 2,
          }
      )
      assert fuse(d, rename_keys=True) == with_deps(
          {
              "NEW": (inc, "z-y"),
              "x-w": (inc, (inc, "z-y")),
              "z-y": (inc, (add, "a", "b")),
              "a": 1,
              "b": 2,
              "w": "x-w",
              "y": "z-y",
          }
      )
  
      d = {
          "v": (inc, "y"),
          "u": (inc, "w"),
          "w": (inc, "x"),
          "x": (inc, "y"),
          "y": (inc, "z"),
          "z": (add, "a", "b"),
          "a": (inc, "c"),
          "b": (inc, "d"),
          "c": 1,
          "d": 2,
      }
      assert fuse(d, rename_keys=False) == with_deps(
          {
              "u": (inc, (inc, (inc, "y"))),
              "v": (inc, "y"),
              "y": (inc, (add, "a", "b")),
              "a": (inc, 1),
              "b": (inc, 2),
          }
      )
      assert fuse(d, rename_keys=True) == with_deps(
          {
              "x-w-u": (inc, (inc, (inc, "z-y"))),
              "v": (inc, "z-y"),
              "z-y": (inc, (add, "c-a", "d-b")),
              "c-a": (inc, 1),
              "d-b": (inc, 2),
              "a": "c-a",
              "b": "d-b",
              "u": "x-w-u",
              "y": "z-y",
          }
      )
  
      d = {
          "a": (inc, "x"),
          "b": (inc, "x"),
          "c": (inc, "x"),
          "d": (inc, "c"),
          "x": (inc, "y"),
          "y": 0,
      }
      assert fuse(d, rename_keys=False) == with_deps(
          {
              "a": (inc, "x"),
              "b": (inc, "x"),
              "d": (inc, (inc, "x")),
              "x": (inc, 0),
          }
      )
      assert fuse(d, rename_keys=True) == with_deps(
          {
              "a": (inc, "y-x"),
              "b": (inc, "y-x"),
              "c-d": (inc, (inc, "y-x")),
              "y-x": (inc, 0),
              "d": "c-d",
              "x": "y-x",
          }
      )
  
      d = {"a": 1, "b": (inc, "a"), "c": (add, "b", "b")}
      assert fuse(d, rename_keys=False) == with_deps(
          {"b": (inc, 1), "c": (add, "b", "b")}
      )
      assert fuse(d, rename_keys=True) == with_deps(
          {"a-b": (inc, 1), "c": (add, "a-b", "a-b"), "b": "a-b"}
      )
  
imports: import itertools
  import pickle
  from functools import partial
  import pytest
  from flash.core.serve.dag.optimization import SubgraphCallable, cull, functions_of, fuse, fuse_linear, inline, inline_functions
  from flash.core.serve.dag.task import get, get_dependencies
  from flash.core.serve.dag.utils import apply, partial_by_order
  from flash.core.serve.dag.utils_test import add, inc
  from flash.core.utilities.imports import _TOPIC_SERVE_AVAILABLE
label_desc: Use image node_id 5 for calling a global function with example usage: test_fuse() without return types