mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-06-30 17:24:22 +00:00
ruff: enable DTZ (flake8-datetimez)
Fixes 44 violations — naive datetime usage replaced with tz-aware equivalents throughout production and test code: - datetime.now() → timezone.now() (Django) or datetime.now(tz=UTC) - datetime.fromtimestamp() → datetime.fromtimestamp(ts, tz=UTC) - datetime.date.today() → timezone.now().date() - datetime.datetime(...) constructors → tzinfo=UTC in tests - UP017 auto-converted datetime.timezone.utc → datetime.UTC (py3.11+) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import datetime
|
||||
import json
|
||||
from datetime import date
|
||||
from unittest import mock
|
||||
from unittest.mock import ANY
|
||||
|
||||
@@ -456,7 +456,7 @@ class TestCustomFieldsAPI(DirectoriesMixin, APITestCase):
|
||||
},
|
||||
)
|
||||
|
||||
date_value = date.today()
|
||||
date_value = datetime.datetime.now(tz=datetime.UTC).date()
|
||||
|
||||
resp = self.client.patch(
|
||||
f"/api/documents/{doc.id}/",
|
||||
@@ -618,7 +618,7 @@ class TestCustomFieldsAPI(DirectoriesMixin, APITestCase):
|
||||
data_type=CustomField.FieldDataType.DATE,
|
||||
)
|
||||
|
||||
date_value = date.today()
|
||||
date_value = datetime.datetime.now(tz=datetime.UTC).date()
|
||||
|
||||
resp = self.client.patch(
|
||||
f"/api/documents/{doc.id}/",
|
||||
|
||||
Reference in New Issue
Block a user