Skip to content

Commit b2f419f

Browse files
committed
test: Fix some lint issues after tornadoweb#3298
That PR arrived while our CI was broken and I manually verified that the tests passed but didn't run the linters. These changes are running in to python/mypy#5088
1 parent 69e4d80 commit b2f419f

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

‎tornado/test/httpclient_test.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -691,11 +691,13 @@ def test_response_times(self):
691691
response = self.fetch("/hello")
692692
response.rethrow()
693693
self.assertIsNotNone(response.request_time)
694+
assert response.request_time is not None # for mypy
694695
self.assertGreaterEqual(response.request_time, 0)
695696
self.assertLess(response.request_time, 1.0)
696697
# A very crude check to make sure that start_time is based on
697698
# wall time and not the monotonic clock.
698699
self.assertIsNotNone(response.start_time)
700+
assert response.start_time is not None # for mypy
699701
self.assertLess(abs(response.start_time - start_time), 1.0)
700702

701703
for k, v in response.time_info.items():

‎tornado/test/web_test.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ def test_cookie_tampering_future_timestamp(self):
132132
cookie = handler._cookies["foo"]
133133
match = re.match(rb"12345678\|([0-9]+)\|([0-9a-f]+)", cookie)
134134
self.assertIsNotNone(match)
135+
assert match is not None # for mypy
135136
timestamp = match.group(1)
136137
sig = match.group(2)
137138
self.assertEqual(
@@ -402,8 +403,10 @@ def test_set_cookie_expires_days(self):
402403
response = self.fetch("/set_expires_days")
403404
header = response.headers.get("Set-Cookie")
404405
self.assertIsNotNone(header)
406+
assert header is not None # for mypy
405407
match = re.match("foo=bar; expires=(?P<expires>.+); Path=/", header)
406408
self.assertIsNotNone(match)
409+
assert match is not None # for mypy
407410

408411
expires = datetime.datetime.now(datetime.timezone.utc) + datetime.timedelta(
409412
days=10

0 commit comments

Comments
 (0)