diff options
author | Damien George <damien.p.george@gmail.com> | 2017-03-24 10:56:02 +1100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2017-03-24 11:00:45 +1100 |
commit | bfb48c1620256b883804c5998f91b8a897b4b6ff (patch) | |
tree | 769d86345381b5e1c86aabb0765e72b194b4f500 /tests/float/builtin_float_round.py | |
parent | c236ebfea705679078f906da484a3ed0bffd32e2 (diff) | |
download | micropython-bfb48c1620256b883804c5998f91b8a897b4b6ff.tar.gz micropython-bfb48c1620256b883804c5998f91b8a897b4b6ff.zip |
tests/float: Add tests for round() of inf, nan and large number.
Diffstat (limited to 'tests/float/builtin_float_round.py')
-rw-r--r-- | tests/float/builtin_float_round.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/float/builtin_float_round.py b/tests/float/builtin_float_round.py index de72514db7..63cb39aa35 100644 --- a/tests/float/builtin_float_round.py +++ b/tests/float/builtin_float_round.py @@ -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)) |