File tree 2 files changed +9
-4
lines changed
2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -502,10 +502,14 @@ cdef inline check_overflows(_TSObject obj):
502
502
# GH#12677
503
503
if obj.dts.year == 1677 :
504
504
if not (obj.value < 0 ):
505
- raise OutOfBoundsDatetime
505
+ raise OutOfBoundsDatetime(
506
+ f' Timestamp cannot be converted within implementation bounds'
507
+ )
506
508
elif obj.dts.year == 2262 :
507
509
if not (obj.value > 0 ):
508
- raise OutOfBoundsDatetime
510
+ raise OutOfBoundsDatetime(
511
+ f' Timestamp cannot be converted within implementation bounds'
512
+ )
509
513
510
514
511
515
# ----------------------------------------------------------------------
Original file line number Diff line number Diff line change @@ -24,16 +24,17 @@ def test_tz_localize_pushes_out_of_bounds(self):
24
24
# GH#12677
25
25
# tz_localize that pushes away from the boundary is OK
26
26
pac = Timestamp .min .tz_localize ("US/Pacific" )
27
+ msg = "Timestamp cannot be converted within implementation bounds"
27
28
assert pac .value > Timestamp .min .value
28
29
pac .tz_convert ("Asia/Tokyo" ) # tz_convert doesn't change value
29
- with pytest .raises (OutOfBoundsDatetime ):
30
+ with pytest .raises (OutOfBoundsDatetime , match = msg ):
30
31
Timestamp .min .tz_localize ("Asia/Tokyo" )
31
32
32
33
# tz_localize that pushes away from the boundary is OK
33
34
tokyo = Timestamp .max .tz_localize ("Asia/Tokyo" )
34
35
assert tokyo .value < Timestamp .max .value
35
36
tokyo .tz_convert ("US/Pacific" ) # tz_convert doesn't change value
36
- with pytest .raises (OutOfBoundsDatetime ):
37
+ with pytest .raises (OutOfBoundsDatetime , match = msg ):
37
38
Timestamp .max .tz_localize ("US/Pacific" )
38
39
39
40
def test_tz_localize_ambiguous_bool (self ):
You can’t perform that action at this time.
0 commit comments