File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ def test_td64_summation_retains_ns_precision_over_expected_range(value: pd.Timed
68
68
@given (
69
69
st .integers (
70
70
min_value = 10 ** (np .finfo (np .float64 ).precision ),
71
- max_value = pd .Timedelta .max .value ,
71
+ max_value = pd .Timedelta .max .value - 2 ** 9 ,
72
72
)
73
73
.filter (lambda i : int (np .float64 (i )) != i )
74
74
.map (pd .Timedelta )
@@ -81,6 +81,20 @@ def test_td64_summation_loses_ns_precision_if_float_conversion_rounds(
81
81
assert result != value
82
82
83
83
84
+ @given (
85
+ st .integers (
86
+ min_value = pd .Timedelta .max .value - 2 ** 9 + 1 ,
87
+ max_value = pd .Timedelta .max .value ,
88
+ ).map (pd .Timedelta )
89
+ )
90
+ def test_td64_summation_raises_spurious_overflow_error_for_single_elem_series_with_near_max_value (
91
+ value : pd .Timedelta ,
92
+ ):
93
+ msg = "Python int too large to convert to C long"
94
+ with pytest .raises (OverflowError , match = msg ):
95
+ pd .Series (value ).sum ()
96
+
97
+
84
98
def test_td64_summation_overflow ():
85
99
# GH#9442
86
100
ser = Series (pd .date_range ("20130101" , periods = 100000 , freq = "H" ))
You can’t perform that action at this time.
0 commit comments