class_docstr: Test server
class_docstr_tok: ["Test","server"]
code: def test_pipeline(self):
      server = HTTPServer(
          api_service.build_service(
              (
                  pipe.input("nums")
                  .map("nums", "sum", sum)
                  .output("sum"),
                  "/sum",
              )
          )
      )
  
      client = TestClient(server.app)
  
      response = client.get("/")
      assert response.status_code == 200
  
      response = client.post("/sum", json=[1, 2, 3])
      assert response.status_code == 200
      self.assertEqual(response.json()[0][0], 6)
  
      response = client.post(
          "/sum/batch", json=[[1, 2, 3], [2, 3, 4], [4, 5, 6]]
      )
      assert response.status_code == 200
      self.assertEqual(response.json()[0][0][0], 6)
      self.assertEqual(response.json()[1][0][0], 9)
      self.assertEqual(response.json()[2][0][0], 15)
  
file_path: towhee/tests/unittests/serve/http/test_http.py
imports: import unittest
  import typing
  from pydantic import BaseModel
  import numpy
  from towhee.utils.thirdparty.fastapi_utils import fastapi
  from fastapi.testclient import TestClient
  from towhee import api_service, pipe
  from towhee.serve.http.server import HTTPServer
  from towhee.serve.io import JSON, NDARRAY, BYTES
  from towhee.utils.serializer import to_json, from_json
label_desc: Use image node_id 4 for calling the TestHTTPServer obj's underlying member method code with example usage: obj.test_pipeline() without return types