88import array
99
1010# SHIFT should match the value in longintrepr.h for best testing.
11- SHIFT = sys .int_info .bits_per_digit
11+ SHIFT = 30 if sys .implementation . name == "ironpython" else sys . int_info .bits_per_digit # https://github.com/IronLanguages/ironpython3/issues/974
1212BASE = 2 ** SHIFT
1313MASK = BASE - 1
1414KARATSUBA_CUTOFF = 70 # from longobject.c
@@ -949,15 +949,21 @@ def test_round(self):
949949 got = round (10 ** k + 324678 , - 3 )
950950 expect = 10 ** k + 325000
951951 self .assertEqual (got , expect )
952- self .assertIs (type (got ), int )
952+ if sys .implementation .name == "ironpython" : # https://github.com/IronLanguages/ironpython3/issues/52
953+ self .assertTrue (isinstance (got , int ))
954+ else :
955+ self .assertIs (type (got ), int )
953956
954957 # nonnegative second argument: round(x, n) should just return x
955958 for n in range (5 ):
956959 for i in range (100 ):
957960 x = random .randrange (- 10000 , 10000 )
958961 got = round (x , n )
959962 self .assertEqual (got , x )
960- self .assertIs (type (got ), int )
963+ if sys .implementation .name == "ironpython" : # https://github.com/IronLanguages/ironpython3/issues/52
964+ self .assertTrue (isinstance (got , int ))
965+ else :
966+ self .assertIs (type (got ), int )
961967 for huge_n in 2 ** 31 - 1 , 2 ** 31 , 2 ** 63 - 1 , 2 ** 63 , 2 ** 100 , 10 ** 100 :
962968 self .assertEqual (round (8979323 , huge_n ), 8979323 )
963969
@@ -966,10 +972,13 @@ def test_round(self):
966972 x = random .randrange (- 10000 , 10000 )
967973 got = round (x )
968974 self .assertEqual (got , x )
969- self .assertIs (type (got ), int )
975+ if sys .implementation .name == "ironpython" : # https://github.com/IronLanguages/ironpython3/issues/52
976+ self .assertTrue (isinstance (got , int ))
977+ else :
978+ self .assertIs (type (got ), int )
970979
971980 # bad second argument
972- bad_exponents = ('brian' , 2.0 , 0j , None )
981+ bad_exponents = ('brian' , 2.0 , 0j )
973982 for e in bad_exponents :
974983 self .assertRaises (TypeError , round , 3 , e )
975984
0 commit comments