summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_b2.py35
-rw-r--r--Lib/test/testall.out1
2 files changed, 36 insertions, 0 deletions
diff --git a/Lib/test/test_b2.py b/Lib/test/test_b2.py
index f376f46..ca06049 100644
--- a/Lib/test/test_b2.py
+++ b/Lib/test/test_b2.py
@@ -123,6 +123,41 @@ if repr(()) <> '()': raise TestFailed, 'repr(())'
if repr([]) <> '[]': raise TestFailed, 'repr([])'
if repr({}) <> '{}': raise TestFailed, 'repr({})'
+print 'round'
+if round(0.0) <> 0.0: raise TestFailed, 'round(0.0)'
+if round(1.0) <> 1.0: raise TestFailed, 'round(1.0)'
+if round(10.0) <> 10.0: raise TestFailed, 'round(10.0)'
+if round(1000000000.0) <> 1000000000.0:
+ raise TestFailed, 'round(1000000000.0)'
+if round(1e20) <> 1e20: raise TestFailed, 'round(1e20)'
+
+if round(-1.0) <> -1.0: raise TestFailed, 'round(-1.0)'
+if round(-10.0) <> -10.0: raise TestFailed, 'round(-10.0)'
+if round(-1000000000.0) <> -1000000000.0:
+ raise TestFailed, 'round(-1000000000.0)'
+if round(-1e20) <> -1e20: raise TestFailed, 'round(-1e20)'
+
+if round(0.1) <> 0.0: raise TestFailed, 'round(0.0)'
+if round(1.1) <> 1.0: raise TestFailed, 'round(1.0)'
+if round(10.1) <> 10.0: raise TestFailed, 'round(10.0)'
+if round(1000000000.1) <> 1000000000.0:
+ raise TestFailed, 'round(1000000000.0)'
+
+if round(-1.1) <> -1.0: raise TestFailed, 'round(-1.0)'
+if round(-10.1) <> -10.0: raise TestFailed, 'round(-10.0)'
+if round(-1000000000.1) <> -1000000000.0:
+ raise TestFailed, 'round(-1000000000.0)'
+
+if round(0.9) <> 1.0: raise TestFailed, 'round(0.9)'
+if round(9.9) <> 10.0: raise TestFailed, 'round(9.9)'
+if round(999999999.9) <> 1000000000.0:
+ raise TestFailed, 'round(999999999.9)'
+
+if round(-0.9) <> -1.0: raise TestFailed, 'round(-0.9)'
+if round(-9.9) <> -10.0: raise TestFailed, 'round(-9.9)'
+if round(-999999999.9) <> -1000000000.0:
+ raise TestFailed, 'round(-999999999.9)'
+
print 'setattr'
import sys
setattr(sys, 'foobar', 1)
diff --git a/Lib/test/testall.out b/Lib/test/testall.out
index f81849b..a711ba2 100644
--- a/Lib/test/testall.out
+++ b/Lib/test/testall.out
@@ -92,6 +92,7 @@ testing
testing
reload
repr
+round
setattr
str
type