16
16
from jupyter_core .utils import ensure_async
17
17
from tornado .concurrent import Future
18
18
from tornado .httpclient import HTTPRequest , HTTPResponse
19
- from tornado .httputil import HTTPServerRequest , HTTPHeaders
19
+ from tornado .httputil import HTTPHeaders , HTTPServerRequest
20
20
from tornado .queues import Queue
21
21
from tornado .web import HTTPError
22
22
from traitlets import Int , Unicode
@@ -372,6 +372,7 @@ def test_gateway_request_timeout_pad_option(
372
372
373
373
GatewayClient .clear_instance ()
374
374
375
+
375
376
@pytest .mark .parametrize (
376
377
"accept_cookies,expire_arg,expire_param,existing_cookies" ,
377
378
[
@@ -399,8 +400,9 @@ def test_gateway_request_with_expiring_cookies(
399
400
cookie_value = "SERVERID=1234567; Path=/; HttpOnly"
400
401
if expire_arg == "expires" :
401
402
# Convert expire_param to a string in the format of "Expires: <date>" (RFC 7231)
402
- expire_param = (datetime .now (tz = timezone .utc ) + timedelta (seconds = expire_param ))\
403
- .strftime ("%a, %d %b %Y %H:%M:%S GMT" )
403
+ expire_param = (datetime .now (tz = timezone .utc ) + timedelta (seconds = expire_param )).strftime (
404
+ "%a, %d %b %Y %H:%M:%S GMT"
405
+ )
404
406
cookie_value = f"SERVERID=1234567; Path=/; expires={ expire_param } ; HttpOnly"
405
407
elif expire_arg == "Max-Age" :
406
408
cookie_value = f"SERVERID=1234567; Path=/; Max-Age={ expire_param } ; HttpOnly"
@@ -421,7 +423,7 @@ def test_gateway_request_with_expiring_cookies(
421
423
connection_args = GatewayClient .instance ().load_connection_args (** args )
422
424
423
425
if not accept_cookies or test_expiration :
424
- # The first condition ensure the response cookie is not accepted,
426
+ # The first condition ensure the response cookie is not accepted,
425
427
# the second condition ensures that the cookie is not accepted if it is expired.
426
428
assert "SERVERID" not in connection_args ["headers" ].get ("Cookie" )
427
429
else :
0 commit comments