code: def test_remove_in_and_out(self):
      var1 = MyVariable("var1")
      var2 = MyVariable("var2")
      op1_out = op1(var2, var1)
      op2_out = op2(op1_out, var2)
      op3_out = op3(op2_out, var2, var2)
      fg = FunctionGraph([var1, var2], [op1_out, op3_out], clone=False)
  
      # Remove an output
      fg.remove_output(1)
      fg.check_integrity()
  
      assert fg.outputs == [op1_out]
      assert op3_out not in fg.clients
      assert not any(
          op3_out.owner in clients
          for clients in sum(fg.clients.values(), [])
      )
  
      # Remove an input
      fg.remove_input(0)
      fg.check_integrity()
  
      assert var1 not in fg.variables
      assert fg.inputs == [var2]
      assert fg.outputs == []
      assert not any(
          op1_out.owner in clients
          for clients in sum(fg.clients.values(), [])
      )
  
imports: import pickle
  import numpy
  import pytest
  from pytensor.configdefaults import config
  from pytensor.graph.basic import NominalVariable
  from pytensor.graph.fg import FunctionGraph
  from pytensor.graph.utils import MissingInputError
  from tests.graph.utils import MyConstant, MyOp, MyType, MyVariable, MyVariable2, op1, op2, op3
label_desc: Use image node_id 20 for calling the TestFunctionGraph obj's underlying member method code with example usage: obj.test_remove_in_and_out() without return types