Skip to content

Commit 78b355e

Browse files
committed
fix chapter2
1 parent 9ad9ea9 commit 78b355e

4 files changed

Lines changed: 7 additions & 5 deletions

File tree

Chapter02/parents-portal/app/home.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
COOKIE_EXPIRATION_TIME = 60
1313

1414

15-
cookies_store = TTLCache( # type: ignore[var-annotated]
15+
cookies_store = TTLCache(
1616
maxsize=100,
1717
ttl=COOKIE_EXPIRATION_TIME,
1818
timer=lambda: time.monotonic(),
@@ -32,7 +32,7 @@ class Lang(StrEnum):
3232
async def home(
3333
request: Request,
3434
lang: Lang,
35-
name: str = Query(default=""),
35+
name: str = Query(default=""), # noqa: FAST002
3636
):
3737
request_cookie = request.cookies.get("TRACKING")
3838
cookie_content = cookies_store.get(request_cookie, "Invalid")

Chapter02/parents-portal/pyproject.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ profile = "jinja"
1919
line-length = 66
2020

2121
[tool.ruff.lint]
22-
select = ["I", "E4", "E7", "E9", "F", "Q"]
22+
select = ["I", "E", "F", "Q", "UP", "FAST"]
23+
24+
[tool.ruff.lint.pycodestyle]
25+
max-line-length=120
2326

2427
[dependency-groups]
2528
dev = [

Chapter02/parents-portal/tests/conftest.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
@pytest.fixture(scope="module")
88
def test_client():
9-
"""Create a TestClient for the app, shared across all tests in the module."""
109
return TestClient(app)
1110

1211

Chapter02/parents-portal/tests/test_cookies.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def test_home_with_cookie_expired(test_client):
2828

2929
# Advance time by expiration + 1 second so the cookie expires
3030
with freeze_time(
31-
datetime.datetime.now(datetime.timezone.utc)
31+
datetime.datetime.now(datetime.UTC)
3232
+ datetime.timedelta(seconds=COOKIE_EXPIRATION_TIME + 1)
3333
):
3434
response = test_client.get("/home")

0 commit comments

Comments
 (0)