File: tests-Use-ZoneInfo-instead-of-pytz.patch

package info (click to toggle)
python-odmantic 1.0.2-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,684 kB
  • sloc: python: 8,547; sh: 37; makefile: 34; xml: 13; javascript: 3
file content (39 lines) | stat: -rw-r--r-- 1,294 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
From: Carsten Schoenert <c.schoenert@t-online.de>
Date: Sun, 29 Dec 2024 20:33:22 +0200
Subject: tests: Use ZoneInfo instead of pytz

---
 tests/unit/test_bson_fields.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/unit/test_bson_fields.py b/tests/unit/test_bson_fields.py
index 08e3208..dd8c98f 100644
--- a/tests/unit/test_bson_fields.py
+++ b/tests/unit/test_bson_fields.py
@@ -4,7 +4,7 @@ from decimal import Decimal
 from typing import Pattern
 
 import pytest
-import pytz
+from zoneinfo import ZoneInfo
 from bson.decimal128 import Decimal128
 from bson.objectid import ObjectId
 from bson.regex import Regex
@@ -23,7 +23,7 @@ def test_datetime_non_naive():
         field: datetime
 
     with pytest.raises(ValueError):
-        ModelWithDate(field=datetime.now(tz=pytz.timezone("Europe/Amsterdam")))
+        ModelWithDate(field=datetime.now(tz=ZoneInfo("Europe/Amsterdam")))
 
     with pytest.raises(ValueError):
         ModelWithDate(field="2018-11-02T23:59:01.824+10:00")
@@ -31,7 +31,7 @@ def test_datetime_non_naive():
 
 def test_datetime_non_naive_utc():
     class ModelWithDate(Model):
-        field: datetime = Field(datetime.now(tz=pytz.utc))
+        field: datetime = Field(datetime.now(tz=ZoneInfo("UTC")))
 
     ModelWithDate()