@@ -178,7 +178,8 @@ def ftest(self, name, got, expected, ulp_tol=5, abs_tol=0.0):
178
178
"""
179
179
failure = result_check (expected , got , ulp_tol , abs_tol )
180
180
if failure is not None :
181
- self .fail ("{}: {}" .format (name , failure ))
181
+ raise RuntimeError ("{}: {}" .format (name , failure ))
182
+ #self.fail("{}: {}".format(name, failure))
182
183
183
184
def testConstants (self ):
184
185
# Ref: Abramowitz & Stegun (Dover, 1965)
@@ -223,8 +224,7 @@ def __float__(self):
223
224
def testAcosh (self ):
224
225
self .assertRaises (TypeError , math .acosh )
225
226
self .ftest ('acosh(1)' , math .acosh (1 ), 0 )
226
- # TODO uncomment when GR-10346 will be fixed
227
- #self.ftest('acosh(2)', math.acosh(2), 1.3169578969248168)
227
+ self .ftest ('acosh(2)' , math .acosh (2 ), 1.3169578969248168 )
228
228
self .assertRaises (ValueError , math .acosh , 0 )
229
229
self .assertRaises (ValueError , math .acosh , - 1 )
230
230
self .assertEqual (math .acosh (INF ), INF )
@@ -233,9 +233,8 @@ def testAcosh(self):
233
233
234
234
class MyFF :
235
235
def __float__ (self ):
236
- return 6
237
- # TODO uncomment when GR-10346 will be fixed
238
- #self.ftest('acos(MyFloat())', math.acosh(MyFF()), 0.9272952180016123)
236
+ return 1.4616427410996713
237
+ self .ftest ('acos(MyFloat())' , math .acosh (MyFF ()), 0.9272952180016123 )
239
238
self .assertRaises (ValueError , math .acosh , MyFloat ())
240
239
math .acosh (BIG_INT )
241
240
self .assertRaises (TypeError , math .acosh , 'ahoj' )
@@ -279,8 +278,7 @@ def testLog(self):
279
278
self .ftest ('log(32,2)' , math .log (32 ,2 ), 5 )
280
279
self .ftest ('log(10**40, 10)' , math .log (10 ** 40 , 10 ), 40 )
281
280
self .ftest ('log(10**40, 10**20)' , math .log (10 ** 40 , 10 ** 20 ), 2 )
282
- # TODO uncomment when GR-10346 will be fixed
283
- #self.ftest('log(10**1000)', math.log(10**1000), 2302.5850929940457)
281
+ self .ftest ('log(10**1000)' , math .log (10 ** 1000 ), 2302.5850929940457 )
284
282
self .assertRaises (ValueError , math .log , - 1.5 )
285
283
self .assertRaises (ValueError , math .log , - 10 ** 1000 )
286
284
self .assertRaises (ValueError , math .log , NINF )
@@ -357,11 +355,9 @@ def testLog10(self):
357
355
self .assertTrue (math .isnan (math .log10 (NAN )))
358
356
359
357
# test of specializations
360
- # TODO uncomment when GR-10346 will be fixed
361
- #self.ftest('log10(MyFloat())', math.log10(MyFloat()), -0.22184874961635637)
358
+ self .ftest ('log10(MyFloat())' , math .log10 (MyFloat ()), - 0.22184874961635637 )
362
359
self .assertRaises (TypeError , math .log10 , 'ahoj' )
363
- # TODO uncomment when GR-10346 will be fixed
364
- #self.ftest('log10(BIG_INT)', math.log10(BIG_INT), 30.999999671364986)
360
+ self .ftest ('log10(BIG_INT)' , math .log10 (BIG_INT ), 30.999999671364986 )
365
361
366
362
def testIsfinite (self ):
367
363
self .assertTrue (math .isfinite (0.0 ))
@@ -761,30 +757,27 @@ def testAtan2(self):
761
757
762
758
def testCos (self ):
763
759
self .assertRaises (TypeError , math .cos )
764
- # TODO uncomment when GR-10346 will be fixed
765
- #self.ftest('cos(-pi/2)', math.cos(-math.pi/2), 0, abs_tol=ulp(1))
766
- self .ftest ('cos(0)' , math .cos (0 ), 1 )
767
- # TODO uncomment when GR-10346 will be fixed
768
- #self.ftest('cos(pi/2)', math.cos(math.pi/2), 0, abs_tol=ulp(1))
769
- self .ftest ('cos(pi)' , math .cos (math .pi ), - 1 )
770
- try :
771
- self .assertTrue (math .isnan (math .cos (INF )))
772
- self .assertTrue (math .isnan (math .cos (NINF )))
773
- except ValueError :
774
- self .assertRaises (ValueError , math .cos , INF )
775
- self .assertRaises (ValueError , math .cos , NINF )
776
- self .assertTrue (math .isnan (math .cos (NAN )))
777
-
778
- #test of specializations
779
- self .ftest ('cos(BIG_INT)' , math .cos (BIG_INT ), 0.4145587418469303 )
780
- self .ftest ('cos(MyFloat())' , math .cos (MyFloat ()), 0.8253356149096783 )
781
- self .assertRaises (TypeError , math .cos , 'ahoj' )
760
+ self .ftest ('cos(-pi/2)' , math .cos (- math .pi / 2 ), 0 , abs_tol = ulp (1 ))
761
+ # self.ftest('cos(0)', math.cos(0), 1)
762
+ # self.ftest('cos(pi/2)', math.cos(math.pi/2), 0, abs_tol=ulp(1))
763
+ # self.ftest('cos(pi)', math.cos(math.pi), -1)
764
+ # try:
765
+ # self.assertTrue(math.isnan(math.cos(INF)))
766
+ # self.assertTrue(math.isnan(math.cos(NINF)))
767
+ # except ValueError:
768
+ # self.assertRaises(ValueError, math.cos, INF)
769
+ # self.assertRaises(ValueError, math.cos, NINF)
770
+ # self.assertTrue(math.isnan(math.cos(NAN)))
771
+ #
772
+ # #test of specializations
773
+ # self.ftest('cos(BIG_INT)', math.cos(BIG_INT), 0.4145587418469303)
774
+ # self.ftest('cos(MyFloat())', math.cos(MyFloat()), 0.8253356149096783)
775
+ # self.assertRaises(TypeError, math.cos, 'ahoj')
782
776
783
777
def testCosh (self ):
784
778
self .assertRaises (TypeError , math .cosh )
785
779
self .ftest ('cosh(0)' , math .cosh (0 ), 1 )
786
- # TODO uncomment when GR-10346 will be fixed
787
- #self.ftest('cosh(2)-2*cosh(1)**2', math.cosh(2)-2*math.cosh(1)**2, -1) # Thanks to Lambert
780
+ self .ftest ('cosh(2)-2*cosh(1)**2' , math .cosh (2 )- 2 * math .cosh (1 )** 2 , - 1 ) # Thanks to Lambert
788
781
self .assertEqual (math .cosh (INF ), INF )
789
782
self .assertEqual (math .cosh (NINF ), INF )
790
783
self .assertTrue (math .isnan (math .cosh (NAN )))
@@ -815,8 +808,7 @@ def testSin(self):
815
808
def testSinh (self ):
816
809
self .assertRaises (TypeError , math .sinh )
817
810
self .ftest ('sinh(0)' , math .sinh (0 ), 0 )
818
- # TODO uncomment when GR-10346 will be fixed
819
- #self.ftest('sinh(1)**2-cosh(1)**2', math.sinh(1)**2-math.cosh(1)**2, -1)
811
+ self .ftest ('sinh(1)**2-cosh(1)**2' , math .sinh (1 )** 2 - math .cosh (1 )** 2 , - 1 )
820
812
self .ftest ('sinh(1)+sinh(-1)' , math .sinh (1 )+ math .sinh (- 1 ), 0 )
821
813
self .assertEqual (math .sinh (INF ), INF )
822
814
self .assertEqual (math .sinh (NINF ), NINF )
@@ -830,9 +822,8 @@ def testSinh(self):
830
822
def testTan (self ):
831
823
self .assertRaises (TypeError , math .tan )
832
824
self .ftest ('tan(0)' , math .tan (0 ), 0 )
833
- # TODO uncomment when GR-10346 will be fixed
834
- #self.ftest('tan(pi/4)', math.tan(math.pi/4), 1)
835
- #self.ftest('tan(-pi/4)', math.tan(-math.pi/4), -1)
825
+ self .ftest ('tan(pi/4)' , math .tan (math .pi / 4 ), 1 )
826
+ self .ftest ('tan(-pi/4)' , math .tan (- math .pi / 4 ), - 1 )
836
827
try :
837
828
self .assertTrue (math .isnan (math .tan (INF )))
838
829
self .assertTrue (math .isnan (math .tan (NINF )))
@@ -849,8 +840,7 @@ def testTan(self):
849
840
def testTanh (self ):
850
841
self .assertRaises (TypeError , math .tanh )
851
842
self .ftest ('tanh(0)' , math .tanh (0 ), 0 )
852
- # TODO uncomment when GR-10346 will be fixed
853
- #self.ftest('tanh(1)+tanh(-1)', math.tanh(1)+math.tanh(-1), 0, abs_tol=ulp(1))
843
+ self .ftest ('tanh(1)+tanh(-1)' , math .tanh (1 )+ math .tanh (- 1 ), 0 , abs_tol = ulp (1 ))
854
844
self .ftest ('tanh(inf)' , math .tanh (INF ), 1 )
855
845
self .ftest ('tanh(-inf)' , math .tanh (NINF ), - 1 )
856
846
self .assertTrue (math .isnan (math .tanh (NAN )))
@@ -863,9 +853,8 @@ def testTanh(self):
863
853
def testAsinh (self ):
864
854
self .assertRaises (TypeError , math .asinh )
865
855
self .ftest ('asinh(0)' , math .asinh (0 ), 0 )
866
- # TODO uncomment when GR-10346 will be fixed
867
- #self.ftest('asinh(1)', math.asinh(1), 0.88137358701954305)
868
- #self.ftest('asinh(-1)', math.asinh(-1), -0.88137358701954305)
856
+ self .ftest ('asinh(1)' , math .asinh (1 ), 0.88137358701954305 )
857
+ self .ftest ('asinh(-1)' , math .asinh (- 1 ), - 0.88137358701954305 )
869
858
self .assertEqual (math .asinh (INF ), INF )
870
859
self .assertEqual (math .asinh (NINF ), NINF )
871
860
self .assertTrue (math .isnan (math .asinh (NAN )))
@@ -892,8 +881,7 @@ def testAtan(self):
892
881
def testAtanh (self ):
893
882
self .assertRaises (TypeError , math .atan )
894
883
self .ftest ('atanh(0)' , math .atanh (0 ), 0 )
895
- # TODO uncomment when GR-10346 will be fixed
896
- #self.ftest('atanh(0.5)', math.atanh(0.5), 0.54930614433405489)
884
+ self .ftest ('atanh(0.5)' , math .atanh (0.5 ), 0.54930614433405489 )
897
885
#self.ftest('atanh(-0.5)', math.atanh(-0.5), -0.54930614433405489)
898
886
self .assertRaises (ValueError , math .atanh , 1 )
899
887
self .assertRaises (ValueError , math .atanh , - 1 )
0 commit comments