MCPcopy Create free account
hub / github.com/EasyIME/PIME / prepare

Method prepare

python/python3/tornado/test/web_test.py:571–596  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

569
570class TypeCheckHandler(RequestHandler):
571 def prepare(self):
572 self.errors = {} # type: typing.Dict[str, str]
573
574 self.check_type("status", self.get_status(), int)
575
576 # get_argument is an exception from the general rule of using
577 # type str for non-body data mainly for historical reasons.
578 self.check_type("argument", self.get_argument("foo"), unicode_type)
579 self.check_type("cookie_key", list(self.cookies.keys())[0], str)
580 self.check_type("cookie_value", list(self.cookies.values())[0].value, str)
581
582 # Secure cookies return bytes because they can contain arbitrary
583 # data, but regular cookies are native strings.
584 if list(self.cookies.keys()) != ["asdf"]:
585 raise Exception(
586 "unexpected values for cookie keys: %r" % self.cookies.keys()
587 )
588 self.check_type("get_secure_cookie", self.get_secure_cookie("asdf"), bytes)
589 self.check_type("get_cookie", self.get_cookie("asdf"), str)
590
591 self.check_type("xsrf_token", self.xsrf_token, bytes)
592 self.check_type("xsrf_form_html", self.xsrf_form_html(), str)
593
594 self.check_type("reverse_url", self.reverse_url("typecheck", "foo"), str)
595
596 self.check_type("request_summary", self._request_summary(), str)
597
598 def get(self, path_component):
599 # path_component uses type unicode instead of str for consistency

Callers

nothing calls this directly

Calls 9

check_typeMethod · 0.95
listFunction · 0.85
get_statusMethod · 0.80
get_argumentMethod · 0.80
get_secure_cookieMethod · 0.80
xsrf_form_htmlMethod · 0.80
_request_summaryMethod · 0.80
get_cookieMethod · 0.45
reverse_urlMethod · 0.45

Tested by

no test coverage detected