class_docstr: Test /component endpoint.
class_docstr_tok: ["Test","\/component","endpoint","."]
docstr: Test request failure when invalid content (file) is provided.
docstr_tok: ["Test","request","failure","when","invalid","content","(","file",")","is","provided","."]
code: def test_invalid_content_request(self):
      """Test request failure when invalid content (file) is provided."""
  
      with mock.patch(
          "streamlit.components.v1.components.os.path.isdir"
      ):
          declare_component("test", path=PATH)
  
      with mock.patch(
          "streamlit.web.server.component_request_handler.open"
      ) as m:
          m.side_effect = OSError("Invalid content")
          response = self._request_component(
              "tests.streamlit.web.server.component_request_handler_test.test"
          )
  
      self.assertEqual(404, response.code)
      self.assertEqual(
          b"read error",
          response.body,
      )
  
file_path: streamlit/lib/tests/streamlit/web/server/component_request_handler_test.py
imports: from unittest import mock
  import tornado.testing
  import tornado.web
  from streamlit.components.v1.components import ComponentRegistry, declare_component
  from streamlit.web.server import ComponentRequestHandler
label_desc: Use image node_id 10 for calling the ComponentRequestHandlerTest obj's underlying member method code with example usage: obj.test_invalid_content_request() without return types