summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--tests/float/builtin_float_round.py7
-rw-r--r--tests/float/builtin_float_round_intbig.py4
2 files changed, 11 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))
diff --git a/tests/float/builtin_float_round_intbig.py b/tests/float/builtin_float_round_intbig.py
new file mode 100644
index 0000000000..2083e3ea3a
--- /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))