class_docstr: Tests the /upload_file endpoint.
class_docstr_tok: ["Tests","the","\/upload_file","endpoint","."]
code: def _upload_files(self, files_body, session_id, file_id):
      # We use requests.Request to construct our multipart/form-data request
      # here, because they are absurdly fiddly to compose, and Tornado
      # doesn't include a utility for building them. We then use self.fetch()
      # to actually send the request to the test server.
      req = requests.Request(
          method="PUT",
          url=self.get_url(
              f"{UPLOAD_FILE_ENDPOINT}/{session_id}/{file_id}"
          ),
          files=files_body,
      ).prepare()
  
      return self.fetch(
          req.url,
          method=req.method,
          headers=req.headers,
          body=req.body,
      )
  
imports: from typing import NamedTuple
  import requests
  import tornado.testing
  import tornado.web
  import tornado.websocket
  from streamlit.logger import get_logger
  from streamlit.runtime.memory_uploaded_file_manager import MemoryUploadedFileManager
  from streamlit.runtime.uploaded_file_manager import UploadedFileManager
  from streamlit.web.server.server import UPLOAD_FILE_ENDPOINT
  from streamlit.web.server.upload_file_request_handler import UploadFileRequestHandler
label_desc: Use image node_id 2 for calling the UploadFileRequestHandlerInvalidSessionTest obj's underlying member method code with example usage: obj._upload_files(files_body, session_id, file_id) and returns: self