class_docstr: Tests for `PathPrefixMiddleware`.
class_docstr_tok: ["Tests","for","`","PathPrefixMiddleware","`","."]
code: def test_nonempty_path_prefix(self):
      app = path_prefix.PathPrefixMiddleware(self._echo_app, "/pfx")
      server = werkzeug_test.Client(app, werkzeug.wrappers.Response)
  
      with self.subTest("at root"):
          response = server.get("/pfx")
          self._assert_ok(response, path="", script="/pfx")
  
      with self.subTest("at root with slash"):
          response = server.get("/pfx/")
          self._assert_ok(response, path="/", script="/pfx")
  
      with self.subTest("at subpath"):
          response = server.get("/pfx/foo/bar")
          self._assert_ok(response, path="/foo/bar", script="/pfx")
  
      with self.subTest("at non-path-component extension"):
          with self.assertRaises(errors.NotFoundError):
              server.get("/pfxz")
  
      with self.subTest("above path prefix"):
          with self.assertRaises(errors.NotFoundError):
              server.get("/hmm")
  
file_path: tensorboard/tensorboard/backend/path_prefix_test.py
imports: import json
  import werkzeug
  from werkzeug import test
  from tensorboard import errors
  from tensorboard import test
  from tensorboard.backend import path_prefix
label_desc: Use image node_id 6 for calling the PathPrefixMiddlewareTest obj's underlying member method code with example usage: obj.test_nonempty_path_prefix() without return types