diff options
Diffstat (limited to 'tests/float/float2int.py')
-rw-r--r-- | tests/float/float2int.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/float/float2int.py b/tests/float/float2int.py index b948755de5..42210b4413 100644 --- a/tests/float/float2int.py +++ b/tests/float/float2int.py @@ -22,3 +22,15 @@ for i in range(0,23): print('fail: 10**%u was %u digits long' % (i, digcnt)); testpass = False print("power of 10 test: %s" % (testpass and 'passed' or 'failed')) + +# test inf conversion +try: + int(float('inf')) +except OverflowError: + print("OverflowError") + +# test nan conversion +try: + int(float('nan')) +except ValueError: + print("ValueError") |