@@ -55,10 +55,7 @@ class CMathTests(unittest.TestCase):
5555 # commented out to allow incremented addition of functions.
5656 #
5757 # list of all functions in cmath
58- # test_functions = [getattr(cmath, fname) for fname in [
59- # 'acos', 'acosh', 'asin', 'asinh', 'atan', 'atanh',
60- # 'cos', 'cosh', 'exp', 'log', 'log10', 'sin', 'sinh',
61- # 'sqrt', 'tan', 'tanh']]
58+ test_functions = [getattr (cmath , fname ) for fname in ['sqrt' ]]
6259 # test first and second arguments independently for 2-argument log
6360 # test_functions.append(lambda x : cmath.log(x, 1729. + 0j))
6461 # test_functions.append(lambda x : cmath.log(14.-27j, x))
@@ -179,8 +176,6 @@ def test_infinity_and_nan_constants(self):
179176 self .assertEqual (repr (cmath .nan ), "nan" )
180177 self .assertEqual (repr (cmath .nanj ), "nanj" )
181178
182- # TODO: RUSTPYTHON
183- @unittest .expectedFailure
184179 def test_user_object (self ):
185180 # Test automatic calling of __complex__ and __float__ by cmath
186181 # functions
@@ -279,8 +274,6 @@ def __float__(self):
279274 self .assertRaises (SomeException , f , MyComplexException ())
280275 self .assertRaises (SomeException , f , MyComplexExceptionOS ())
281276
282- # TODO: RUSTPYTHON
283- @unittest .expectedFailure
284277 def test_input_type (self ):
285278 # ints should be acceptable inputs to all cmath
286279 # functions, by virtue of providing a __float__ method
@@ -326,11 +319,16 @@ def test_cmath_matches_math(self):
326319 'sinh' : real_line ,
327320 'sqrt' : nonnegative ,
328321 'tan' : real_line ,
329- 'tanh' : real_line }
322+ 'tanh' : real_line
323+ }
330324
331325 for fn , values in test_functions .items ():
332326 float_fn = getattr (math , fn )
333- complex_fn = getattr (cmath , fn )
327+ # TODO: RUSTPYTHON replace with 'complex_fn = getattr(cmath, fn)'
328+ # when all functions have been added.
329+ complex_fn = getattr (cmath , fn , None )
330+ if complex_fn is None :
331+ continue
334332 for v in values :
335333 z = complex_fn (v )
336334 self .rAssertAlmostEqual (float_fn (v ), z .real )
0 commit comments