class_docstr: Unit tests for Visualizer.
class_docstr_tok: ["Unit","tests","for","Visualizer","."]
code: def test_json(self):
      p = (
          pipe.input("a")
          .map("a", "b", lambda x: x + 1)
          .output("a", "b")
      )
  
      v0 = p.debug(1, profiler=True, tracer=True)
      v0._result = None
      info = v0.to_json()
  
      v1 = Visualizer.from_json(info)
      v2 = p.debug(1, profiler=True, tracer=True)
      self.assertListEqual(
          [i.time_record for i in v0.time_profiler],
          [i.time_record for i in v1.time_profiler],
      )
      for i, j in zip(v2._node_collection, v1._node_collection):
          self.assertListEqual(
              [m["next"] for m in i.values()],
              [n["next"] for n in j.values()],
          )
          self.assertListEqual(
              [m.get("previous") for m in i.values()],
              [n.get("previous") for n in j.values()],
          )
          self.assertListEqual(
              [m.get("in")[0].to_dict() for m in i.values()],
              [n.get("in")[0].to_dict() for n in j.values()],
          )
          self.assertListEqual(
              [m.get("out")[0].to_dict() for m in i.values()],
              [n.get("out")[0].to_dict() for n in j.values()],
          )
  
file_path: towhee/tests/unittests/tools/test_visualizer.py
imports: import unittest
  from towhee import pipe
  from towhee.tools import visualizer
  from towhee.tools.visualizer import Visualizer
  from towhee.runtime.data_queue import DataQueue
label_desc: Use image node_id 9 for calling the TestVisualizer obj's underlying member method code with example usage: obj.test_json() without return types