Skip to content

Commit 11ed996

Browse files
committed
fix: add some tests with the same timestamps but with seconds, milliseconds and infer to show behaviour
1 parent 7df52a1 commit 11ed996

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

tests/validators/test_date.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,13 +312,19 @@ def test_date_past_future_today():
312312
('seconds', 1654646400, date(2022, 6, 8)),
313313
('seconds', '1654646400', date(2022, 6, 8)),
314314
('seconds', 1654646400.0, date(2022, 6, 8)),
315+
('seconds', 8640000000.0 , date(2243, 10, 17)),
316+
('seconds', 92534400000.0 , date(4902, 4, 20)),
315317
# 'milliseconds' mode: treat as milliseconds since epoch
316318
('milliseconds', 1654646400000, date(2022, 6, 8)),
317319
('milliseconds', '1654646400000', date(2022, 6, 8)),
318320
('milliseconds', 1654646400000.0, date(2022, 6, 8)),
321+
('milliseconds', 8640000000.0 , date(1970, 4, 11)),
322+
('milliseconds', 92534400000.0 , date(1972, 12, 7)),
319323
# 'infer' mode: large numbers are ms, small are s
320324
('infer', 1654646400, date(2022, 6, 8)),
321325
('infer', 1654646400000, date(2022, 6, 8)),
326+
('infer', 8640000000.0 , date(2243, 10, 17)),
327+
('infer', 92534400000.0 , date(1972, 12, 7)),
322328
],
323329
)
324330
def test_val_temporal_unit_date(val_temporal_unit, input_value, expected):

tests/validators/test_datetime.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,10 +529,14 @@ def test_tz_cmp() -> None:
529529
('seconds', 1654646400, datetime(2022, 6, 8, tzinfo=timezone.utc)),
530530
('seconds', '1654646400', datetime(2022, 6, 8, tzinfo=timezone.utc)),
531531
('seconds', 1654646400.123456, datetime(2022, 6, 8, 0, 0, 0, 123456, tzinfo=timezone.utc)),
532+
('seconds', 8640000000.0 , datetime(2243, 10, 17, tzinfo=timezone.utc)),
533+
('seconds', 92534400000.0 , datetime(4902, 4, 20, tzinfo=timezone.utc)),
532534
# 'milliseconds' mode: treat as milliseconds since epoch
533535
('milliseconds', 1654646400, datetime(1970, 1, 20, 3, 37, 26, 400000, tzinfo=timezone.utc)),
534536
('milliseconds', 1654646400123, datetime(2022, 6, 8, 0, 0, 0, 123000, tzinfo=timezone.utc)),
535537
('milliseconds', '1654646400123', datetime(2022, 6, 8, 0, 0, 0, 123000, tzinfo=timezone.utc)),
538+
('milliseconds', 8640000000.0 , datetime(1970, 4, 11, tzinfo=timezone.utc)),
539+
('milliseconds', 92534400000.0 , datetime(1972, 12, 7, tzinfo=timezone.utc)),
536540
pytest.param(
537541
'milliseconds',
538542
1654646400123.456,
@@ -548,6 +552,8 @@ def test_tz_cmp() -> None:
548552
datetime(2022, 6, 8, 0, 0, 0, 123456, tzinfo=timezone.utc),
549553
marks=pytest.mark.xfail(reason='Current behaviour means this fails', strict=True),
550554
),
555+
('infer', 8640000000.0 , datetime(2243, 10, 17, tzinfo=timezone.utc)),
556+
('infer', 92534400000.0 , datetime(1972, 12, 7, tzinfo=timezone.utc)),
551557
],
552558
)
553559
def test_val_temporal_unit_datetime(val_temporal_unit, input_value, expected):

0 commit comments

Comments
 (0)