File tree Expand file tree Collapse file tree 2 files changed +5
-9
lines changed
Filter options
Expand file tree Collapse file tree 2 files changed +5
-9
lines changed
Original file line number Diff line number Diff line change @@ -1950,8 +1950,6 @@ def test_error_cases(self):
1950
1950
with self .assertRaises (TypeError ):
1951
1951
fmean ([10 , 20 , 60 ], 70 ) # too many arguments
1952
1952
1953
- # TODO: RUSTPYTHON
1954
- @unittest .expectedFailure
1955
1953
def test_special_values (self ):
1956
1954
# Rules for special values are inherited from math.fsum()
1957
1955
fmean = statistics .fmean
@@ -2913,12 +2911,7 @@ def setUp(self):
2913
2911
2914
2912
def tearDown (self ):
2915
2913
sys .modules ['statistics' ] = statistics
2916
-
2917
- # TODO: RUSTPYTHON, ValueError: math domain error
2918
- @unittest .expectedFailure
2919
- def test_inv_cdf (self ): # TODO: RUSTPYTHON, remove when this passes
2920
- super ().test_inv_cdf () # TODO: RUSTPYTHON, remove when this passes
2921
-
2914
+
2922
2915
2923
2916
@unittest .skipUnless (c_statistics , 'requires _statistics' )
2924
2917
class TestNormalDistC (unittest .TestCase , TestNormalDist ):
Original file line number Diff line number Diff line change @@ -211,6 +211,9 @@ mod math {
211
211
#[ pyfunction]
212
212
fn sqrt ( value : ArgIntoFloat , vm : & VirtualMachine ) -> PyResult < f64 > {
213
213
let value = * value;
214
+ if value. is_nan ( ) {
215
+ return Ok ( value) ;
216
+ }
214
217
if value. is_sign_negative ( ) {
215
218
return Err ( vm. new_value_error ( "math domain error" . to_owned ( ) ) ) ;
216
219
}
@@ -664,7 +667,7 @@ mod math {
664
667
}
665
668
if special_sum != 0.0 {
666
669
return if inf_sum. is_nan ( ) {
667
- Err ( vm. new_overflow_error ( "-inf + inf in fsum" . to_owned ( ) ) )
670
+ Err ( vm. new_value_error ( "-inf + inf in fsum" . to_owned ( ) ) )
668
671
} else {
669
672
Ok ( special_sum)
670
673
} ;
You can’t perform that action at this time.
0 commit comments