class_docstr: Unit test for triton client.
class_docstr_tok: ["Unit","test","for","triton","client","."]
code: def test_pipeline_model(self):
      p = (
          pipe.input("num")
          .map("num", "arr", lambda x: x * 10)
          .map(("num", "arr"), "ret", lambda x, y: x + y)
          .output("ret")
      )
  
      with TemporaryDirectory(dir="./") as root:
          pf = Path(root) / "pipe.pickle"
          with open(pf, "wb") as f:
              pickle.dump(p.dag_repr, f)
          model = pipe_model.TritonPythonModel()
          model._load_pipeline(pf)
  
      # with triton_client.Client('localhost:8000') as client:
      pipe_inputs = [1, 2, 3, 4, 5, 6, 7]
      batch_size = 2
      batch_inputs = [
          triton_client.Client._solve_inputs(
              pipe_inputs[i : i + batch_size]
          )
          for i in range(0, len(pipe_inputs), batch_size)
      ]
      inputs = []
      for item in batch_inputs:
          inputs.append(
              pb_utils.InferenceRequest(
                  [pb_utils.Tensor("INPUT0", item[0].data())],
                  [],
                  "pipeline",
              )
          )
  
      res = model.execute(inputs)
      result = []
      expect = [[[11]], [[22]], [[33]], [[44]], [[55]], [[66]], [[77]]]
      for r in res:
          data = MockRes(r)
          result.extend(from_json(data.as_numpy("OUTPUT0")[0]))
      self.assertEqual(result, expect)
  
imports: from typing import List
  import unittest
  from unittest import mock
  from pathlib import Path
  from tempfile import TemporaryDirectory
  import numpy
  from towhee import pipe
  from towhee.serve.triton import triton_client
  from towhee.utils.thirdparty.dill_util import dill
  import towhee.serve.triton.bls.pipeline_model
  from towhee.serve.triton.bls.python_backend_wrapper import pb_utils
  from towhee.utils.serializer import from_json
label_desc: Use image node_id 4 for calling the TestTritonClient obj's underlying member method code with example usage: obj.test_pipeline_model() without return types