diff --git a/tornado/test/httpclient_test.py b/tornado/test/httpclient_test.py index 793dce13c5..1eb758b555 100644 --- a/tornado/test/httpclient_test.py +++ b/tornado/test/httpclient_test.py @@ -691,11 +691,13 @@ def test_response_times(self): response = self.fetch("/hello") response.rethrow() self.assertIsNotNone(response.request_time) + assert response.request_time is not None # for mypy self.assertGreaterEqual(response.request_time, 0) self.assertLess(response.request_time, 1.0) # A very crude check to make sure that start_time is based on # wall time and not the monotonic clock. self.assertIsNotNone(response.start_time) + assert response.start_time is not None # for mypy self.assertLess(abs(response.start_time - start_time), 1.0) for k, v in response.time_info.items(): diff --git a/tornado/test/web_test.py b/tornado/test/web_test.py index 2fa146d130..ecd7263566 100644 --- a/tornado/test/web_test.py +++ b/tornado/test/web_test.py @@ -132,6 +132,7 @@ def test_cookie_tampering_future_timestamp(self): cookie = handler._cookies["foo"] match = re.match(rb"12345678\|([0-9]+)\|([0-9a-f]+)", cookie) self.assertIsNotNone(match) + assert match is not None # for mypy timestamp = match.group(1) sig = match.group(2) self.assertEqual( @@ -402,8 +403,10 @@ def test_set_cookie_expires_days(self): response = self.fetch("/set_expires_days") header = response.headers.get("Set-Cookie") self.assertIsNotNone(header) + assert header is not None # for mypy match = re.match("foo=bar; expires=(?P.+); Path=/", header) self.assertIsNotNone(match) + assert match is not None # for mypy expires = datetime.datetime.now(datetime.timezone.utc) + datetime.timedelta( days=10