(self)
| 569 | |
| 570 | class 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 |
nothing calls this directly
no test coverage detected