File tree Expand file tree Collapse file tree 2 files changed +5
-9
lines changed
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):
19501950 with self .assertRaises (TypeError ):
19511951 fmean ([10 , 20 , 60 ], 70 ) # too many arguments
19521952
1953- # TODO: RUSTPYTHON
1954- @unittest .expectedFailure
19551953 def test_special_values (self ):
19561954 # Rules for special values are inherited from math.fsum()
19571955 fmean = statistics .fmean
@@ -2913,12 +2911,7 @@ def setUp(self):
29132911
29142912 def tearDown (self ):
29152913 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+
29222915
29232916@unittest .skipUnless (c_statistics , 'requires _statistics' )
29242917class TestNormalDistC (unittest .TestCase , TestNormalDist ):
Original file line number Diff line number Diff line change @@ -211,6 +211,9 @@ mod math {
211211 #[ pyfunction]
212212 fn sqrt ( value : ArgIntoFloat , vm : & VirtualMachine ) -> PyResult < f64 > {
213213 let value = * value;
214+ if value. is_nan ( ) {
215+ return Ok ( value) ;
216+ }
214217 if value. is_sign_negative ( ) {
215218 return Err ( vm. new_value_error ( "math domain error" . to_owned ( ) ) ) ;
216219 }
@@ -664,7 +667,7 @@ mod math {
664667 }
665668 if special_sum != 0.0 {
666669 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 ( ) ) )
668671 } else {
669672 Ok ( special_sum)
670673 } ;
You can’t perform that action at this time.
0 commit comments