From bfb48c1620256b883804c5998f91b8a897b4b6ff Mon Sep 17 00:00:00 2001
From: Damien George <damien.p.george@gmail.com>
Date: Fri, 24 Mar 2017 10:56:02 +1100
Subject: [PATCH] tests/float: Add tests for round() of inf, nan and large
 number.

---
 tests/float/builtin_float_round.py        | 7 +++++++
 tests/float/builtin_float_round_intbig.py | 4 ++++
 2 files changed, 11 insertions(+)
 create mode 100644 tests/float/builtin_float_round_intbig.py

diff --git a/tests/float/builtin_float_round.py b/tests/float/builtin_float_round.py
index de72514db..63cb39aa3 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))
diff --git a/tests/float/builtin_float_round_intbig.py b/tests/float/builtin_float_round_intbig.py
new file mode 100644
index 000000000..2083e3ea3
--- /dev/null
+++ b/tests/float/builtin_float_round_intbig.py
@@ -0,0 +1,4 @@
+# test round() with floats that return large integers
+
+for x in (-1e25, 1e25):
+    print('%.3g' % round(x))
-- 
GitLab