@@ -2177,7 +2177,7 @@ def test_isqrt_frac_rto(self):
2177
2177
self .assertTrue (m * (r - 1 )** 2 < n < m * (r + 1 )** 2 )
2178
2178
2179
2179
@requires_IEEE_754
2180
- def test_sqrt_frac (self ):
2180
+ def test_float_sqrt_of_frac (self ):
2181
2181
2182
2182
def is_root_correctly_rounded (x : Fraction , root : float ) -> bool :
2183
2183
if not x :
@@ -2204,24 +2204,24 @@ def is_root_correctly_rounded(x: Fraction, root: float) -> bool:
2204
2204
denonimator : int = randrange (10 ** randrange (50 )) + 1
2205
2205
with self .subTest (numerator = numerator , denonimator = denonimator ):
2206
2206
x : Fraction = Fraction (numerator , denonimator )
2207
- root : float = statistics ._sqrt_frac (numerator , denonimator )
2207
+ root : float = statistics ._float_sqrt_of_frac (numerator , denonimator )
2208
2208
self .assertTrue (is_root_correctly_rounded (x , root ))
2209
2209
2210
2210
# Verify that corner cases and error handling match math.sqrt()
2211
- self .assertEqual (statistics ._sqrt_frac (0 , 1 ), 0.0 )
2211
+ self .assertEqual (statistics ._float_sqrt_of_frac (0 , 1 ), 0.0 )
2212
2212
with self .assertRaises (ValueError ):
2213
- statistics ._sqrt_frac (- 1 , 1 )
2213
+ statistics ._float_sqrt_of_frac (- 1 , 1 )
2214
2214
with self .assertRaises (ValueError ):
2215
- statistics ._sqrt_frac (1 , - 1 )
2215
+ statistics ._float_sqrt_of_frac (1 , - 1 )
2216
2216
2217
2217
# Error handling for zero denominator matches that for Fraction(1, 0)
2218
2218
with self .assertRaises (ZeroDivisionError ):
2219
- statistics ._sqrt_frac (1 , 0 )
2219
+ statistics ._float_sqrt_of_frac (1 , 0 )
2220
2220
2221
2221
# The result is well defined if both inputs are negative
2222
- self .assertEqual (statistics ._sqrt_frac (- 2 , - 1 ), statistics ._sqrt_frac (2 , 1 ))
2222
+ self .assertEqual (statistics ._float_sqrt_of_frac (- 2 , - 1 ), statistics ._float_sqrt_of_frac (2 , 1 ))
2223
2223
2224
- def test_deci_sqrt (self ):
2224
+ def test_decimal_sqrt_of_frac (self ):
2225
2225
root : Decimal
2226
2226
numerator : int
2227
2227
denominator : int
@@ -2232,7 +2232,7 @@ def test_deci_sqrt(self):
2232
2232
(Decimal ('0.8500554152289934068192208727' ), 722594208960136395984391238251 , 1000000000000000000000000000000 ), # Adj down
2233
2233
]:
2234
2234
with decimal .localcontext (decimal .DefaultContext ):
2235
- self .assertEqual (statistics ._deci_sqrt (numerator , denominator ), root )
2235
+ self .assertEqual (statistics ._decimal_sqrt_of_frac (numerator , denominator ), root )
2236
2236
2237
2237
# Confirm expected root with a quad precision decimal computation
2238
2238
with decimal .localcontext (decimal .DefaultContext ) as ctx :
@@ -2243,18 +2243,18 @@ def test_deci_sqrt(self):
2243
2243
self .assertEqual (root , target_root )
2244
2244
2245
2245
# Verify that corner cases and error handling match Decimal.sqrt()
2246
- self .assertEqual (statistics ._deci_sqrt (0 , 1 ), 0.0 )
2246
+ self .assertEqual (statistics ._decimal_sqrt_of_frac (0 , 1 ), 0.0 )
2247
2247
with self .assertRaises (decimal .InvalidOperation ):
2248
- statistics ._deci_sqrt (- 1 , 1 )
2248
+ statistics ._decimal_sqrt_of_frac (- 1 , 1 )
2249
2249
with self .assertRaises (decimal .InvalidOperation ):
2250
- statistics ._deci_sqrt (1 , - 1 )
2250
+ statistics ._decimal_sqrt_of_frac (1 , - 1 )
2251
2251
2252
2252
# Error handling for zero denominator matches that for Fraction(1, 0)
2253
2253
with self .assertRaises (ZeroDivisionError ):
2254
- statistics ._deci_sqrt (1 , 0 )
2254
+ statistics ._decimal_sqrt_of_frac (1 , 0 )
2255
2255
2256
2256
# The result is well defined if both inputs are negative
2257
- self .assertEqual (statistics ._deci_sqrt (- 2 , - 1 ), statistics ._deci_sqrt (2 , 1 ))
2257
+ self .assertEqual (statistics ._decimal_sqrt_of_frac (- 2 , - 1 ), statistics ._decimal_sqrt_of_frac (2 , 1 ))
2258
2258
2259
2259
2260
2260
class TestStdev (VarianceStdevMixin , NumericTestCase ):
0 commit comments