tests/float: Add tests for round() of inf, nan and large number.
This commit is contained in:
parent
c236ebfea7
commit
bfb48c1620
|
@ -15,3 +15,10 @@ for i in range(11):
|
|||
# test second arg
|
||||
for i in range(-1, 3):
|
||||
print(round(1.47, i))
|
||||
|
||||
# test inf and nan
|
||||
for val in (float('inf'), float('nan')):
|
||||
try:
|
||||
round(val)
|
||||
except (ValueError, OverflowError) as e:
|
||||
print(type(e))
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
# test round() with floats that return large integers
|
||||
|
||||
for x in (-1e25, 1e25):
|
||||
print('%.3g' % round(x))
|
Loading…
Reference in New Issue