Skip to content

Commit

Permalink
fix utc now handling
Browse files Browse the repository at this point in the history
  • Loading branch information
blink1073 committed Oct 14, 2024
1 parent 67c1631 commit 7638e12
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions bindings/python/test/test_builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import calendar
from datetime import UTC, date, datetime, timedelta
from datetime import date, datetime, timedelta, timezone
from unittest import TestCase

from bson import Binary, Code, Decimal128, ObjectId
Expand Down Expand Up @@ -86,7 +86,7 @@ def test_simple(self):
self.maxDiff = None

builder = DatetimeBuilder(dtype=timestamp("ms"))
datetimes = [datetime.now(UTC) + timedelta(days=k * 100) for k in range(5)]
datetimes = [datetime.now(timezone.UTC) + timedelta(days=k * 100) for k in range(5)]
builder.append(self._datetime_to_millis(datetimes[0]))
builder.append_values([self._datetime_to_millis(k) for k in datetimes[1:]])
builder.append_null()
Expand Down
6 changes: 3 additions & 3 deletions bindings/python/test/test_datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import unittest
from datetime import UTC, datetime, timedelta
from datetime import datetime, timedelta, timezone
from test import client_context

import pytz
Expand All @@ -36,8 +36,8 @@ def setUp(self):
self.coll.drop()
self.coll.insert_many(
[
{"_id": 1, "data": datetime.now(UTC) + timedelta(milliseconds=10)},
{"_id": 2, "data": datetime.now(UTC) + timedelta(milliseconds=25)},
{"_id": 1, "data": datetime.now(timezone.UTC) + timedelta(milliseconds=10)},
{"_id": 2, "data": datetime.now(timezone.UTC) + timedelta(milliseconds=25)},
]
)
self.expected_times = []
Expand Down

0 comments on commit 7638e12

Please sign in to comment.