Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/libkernelbot/submission.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import copy
import dataclasses
import datetime
import math
import typing
from datetime import datetime
from typing import Optional, Union

from better_profanity import profanity
Expand Down Expand Up @@ -87,7 +87,7 @@ def prepare_submission(


def check_deadline(leaderboard: LeaderboardItem):
now = datetime.now()
now = datetime.datetime.now(datetime.timezone.utc)
Copy link

Copilot AI Nov 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests in test_check_deadline() use naive datetime objects (datetime.datetime.now() without timezone), but the production code now uses timezone-aware datetime objects (datetime.datetime.now(datetime.timezone.utc)). This mismatch means the tests are not accurately testing the actual behavior.

The tests should be updated to use timezone-aware datetime objects to match the production code:

def test_check_deadline():
    # Test valid deadline (future)
    future_deadline: LeaderboardItem = {
        "deadline": datetime.datetime.now(datetime.timezone.utc) + datetime.timedelta(days=1),
        "name": "test",
    }
    submission.check_deadline(future_deadline)  # Should not raise

    # Test expired deadline
    past_deadline: LeaderboardItem = {
        "deadline": datetime.datetime.now(datetime.timezone.utc) - datetime.timedelta(days=1),
        "name": "test",
    }
    # ...

Additionally, the mock in mock_backend fixture (line 30) should also use timezone-aware datetime.

Copilot uses AI. Check for mistakes.
deadline = leaderboard["deadline"]

if now > deadline:
Expand Down
Loading