Skip to content

Commit 87258a9

Browse files
committed
PYTHON-4663 Fix _max_datetime_ms() -> _MAX_DATETIME_MS refactor in tests
1 parent 43286aa commit 87258a9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

test/test_json_util.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
UuidRepresentation,
4040
)
4141
from bson.code import Code
42-
from bson.datetime_ms import _max_datetime_ms
42+
from bson.datetime_ms import _MAX_DATETIME_MS
4343
from bson.dbref import DBRef
4444
from bson.decimal128 import Decimal128
4545
from bson.int64 import Int64
@@ -257,7 +257,7 @@ def test_datetime(self):
257257
def test_datetime_ms(self):
258258
# Test ISO8601 in-range
259259
dat_min: dict[str, Any] = {"x": DatetimeMS(0)}
260-
dat_max: dict[str, Any] = {"x": DatetimeMS(_max_datetime_ms())}
260+
dat_max: dict[str, Any] = {"x": DatetimeMS(_MAX_DATETIME_MS)}
261261
opts = JSONOptions(datetime_representation=DatetimeRepresentation.ISO8601)
262262

263263
self.assertEqual(
@@ -271,7 +271,7 @@ def test_datetime_ms(self):
271271

272272
# Test ISO8601 out-of-range
273273
dat_min = {"x": DatetimeMS(-1)}
274-
dat_max = {"x": DatetimeMS(_max_datetime_ms() + 1)}
274+
dat_max = {"x": DatetimeMS(_MAX_DATETIME_MS + 1)}
275275

276276
self.assertEqual('{"x": {"$date": {"$numberLong": "-1"}}}', json_util.dumps(dat_min))
277277
self.assertEqual(
@@ -302,7 +302,7 @@ def test_datetime_ms(self):
302302

303303
# Test decode from datetime.datetime to DatetimeMS
304304
dat_min = {"x": datetime.datetime.min}
305-
dat_max = {"x": DatetimeMS(_max_datetime_ms()).as_datetime(CodecOptions(tz_aware=False))}
305+
dat_max = {"x": DatetimeMS(_MAX_DATETIME_MS).as_datetime(CodecOptions(tz_aware=False))}
306306
opts = JSONOptions(
307307
datetime_representation=DatetimeRepresentation.ISO8601,
308308
datetime_conversion=DatetimeConversion.DATETIME_MS,

0 commit comments

Comments
 (0)