From 0dc3bf941aac3e329b1f5d98fd90842cac191e6b Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Sat, 10 Aug 2019 13:08:59 -0700 Subject: [PATCH] Improve type of tornado.testing.gen_test. (#3174) gen_test can accept a timeout parameter. See https://www.tornadoweb.org/en/branch5.1/testing.html#tornado.testing.gen_test. --- third_party/2/tornado/testing.pyi | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/third_party/2/tornado/testing.pyi b/third_party/2/tornado/testing.pyi index 25fd0e59e..adc7fcda6 100644 --- a/third_party/2/tornado/testing.pyi +++ b/third_party/2/tornado/testing.pyi @@ -1,4 +1,4 @@ -from typing import Any, Optional +from typing import Any, Callable, Generator, Optional, overload import unittest import logging @@ -42,7 +42,13 @@ class AsyncHTTPSTestCase(AsyncHTTPTestCase): def get_ssl_options(self): ... def get_protocol(self): ... -def gen_test(f): ... +@overload +def gen_test(*, timeout: Optional[float] = ...) -> Callable[[Callable[..., Generator]], Callable[..., None]]: + ... + +@overload +def gen_test(func: Callable[..., Generator]) -> Callable[..., None]: + ... class LogTrapTestCase(unittest.TestCase): def run(self, result: Optional[Any] = ...): ...