code: def test_debugprint_inner_graph():
      r1, r2 = MyVariable("1"), MyVariable("2")
      o1 = MyOp("op1")(r1, r2)
      o1.name = "o1"
  
      # Inner graph
      igo_in_1 = MyVariable("4")
      igo_in_2 = MyVariable("5")
      igo_out_1 = MyOp("op2")(igo_in_1, igo_in_2)
      igo_out_1.name = "igo1"
  
      igo = MyInnerGraphOp([igo_in_1, igo_in_2], [igo_out_1])
  
      r3, r4 = MyVariable("3"), MyVariable("4")
      out = igo(r3, r4)
  
      output_str = debugprint(out, file="str")
      lines = output_str.split("\n")
  
      exp_res = """MyInnerGraphOp [id A]
   ├─ 3 [id B]
   └─ 4 [id C]
  
  Inner graphs:
  
  MyInnerGraphOp [id A]
   ← op2 [id D] 'igo1'
      ├─ *0-<MyType()> [id E]
      └─ *1-<MyType()> [id F]
      """
  
      for exp_line, res_line in zip(exp_res.split("\n"), lines):
          assert exp_line.strip() == res_line.strip()
  
      # Test nested inner-graph `Op`s
      igo_2 = MyInnerGraphOp([r3, r4], [out])
  
      r5 = MyVariable("5")
      out_2 = igo_2(r5)
  
      output_str = debugprint(out_2, file="str")
      lines = output_str.split("\n")
  
      exp_res = """MyInnerGraphOp [id A]
   └─ 5 [id B]
  
  Inner graphs:
  
  MyInnerGraphOp [id A]
   ← MyInnerGraphOp [id C]
      ├─ *0-<MyType()> [id D]
      └─ *1-<MyType()> [id E]
  
  MyInnerGraphOp [id C]
   ← op2 [id F] 'igo1'
      ├─ *0-<MyType()> [id D]
      └─ *1-<MyType()> [id E]
      """
  
      for exp_line, res_line in zip(exp_res.split("\n"), lines):
          assert exp_line.strip() == res_line.strip()
  
imports: import logging
  from io import StringIO
  from textwrap import dedent
  import numpy
  import pytest
  import pytensor
  from pytensor.compile.mode import get_mode
  from pytensor.compile.ops import deep_copy_op
  from pytensor.printing import PatternPrinter, PPrinter, Print, debugprint, default_printer, get_node_by_id, min_informative_str, pp, pydot_imported, pydotprint
  from pytensor.tensor import as_tensor_variable
  from pytensor.tensor.type import dmatrix, dvector, matrix
  from tests.graph.utils import MyInnerGraphOp, MyOp, MyVariable
label_desc: Use image node_id 9 for calling a global function with example usage: test_debugprint_inner_graph() without return types