Skip to content

Commit

Permalink
test: Fix some lint issues after tornadoweb#3298
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bdarnell committed Jun 10, 2024
1 parent 69e4d80 commit b2f419f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tornado/test/httpclient_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
3 changes: 3 additions & 0 deletions tornado/test/web_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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<expires>.+); Path=/", header)
self.assertIsNotNone(match)
assert match is not None # for mypy

expires = datetime.datetime.now(datetime.timezone.utc) + datetime.timedelta(
days=10
Expand Down

0 comments on commit b2f419f

Please sign in to comment.