summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2001-12-29 00:35:20 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2001-12-29 00:35:20 (GMT)
commit32f41536cbcae7ebcec748a66165b210cfe88fd7 (patch)
tree0d2ad6dbc7657d6ea7071dcd6d4e407923bd6106 /Lib/test
parent707690132fc28773843eb154c8c8c1599c4fe5c8 (diff)
downloadcpython-32f41536cbcae7ebcec748a66165b210cfe88fd7.zip
cpython-32f41536cbcae7ebcec748a66165b210cfe88fd7.tar.gz
cpython-32f41536cbcae7ebcec748a66165b210cfe88fd7.tar.bz2
SF Patch #494874 add tests for int()/long() invalid parameters
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_b1.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/Lib/test/test_b1.py b/Lib/test/test_b1.py
index f2d0c24..17f0411 100644
--- a/Lib/test/test_b1.py
+++ b/Lib/test/test_b1.py
@@ -432,6 +432,21 @@ try: int('123\0')
except ValueError: pass
else: raise TestFailed("int('123\0') didn't raise exception")
+try: int('53', 40)
+except ValueError: pass
+else: raise TestFailed("int('53', 40) didn't raise ValueError")
+
+try: int('1' * 512)
+except ValueError: pass
+else: raise TestFailed("int('1' * 512) didn't raise ValueError")
+
+try: int(1, 12)
+except TypeError: pass
+else: raise TestFailed("int(1, 12) didn't raise TypeError")
+
+if int('0123', 0) != 83:
+ raise TestFailed("int('0123', 0) != 83")
+
print 'isinstance'
class C:
pass
@@ -524,6 +539,14 @@ try: long('123\0')
except ValueError: pass
else: raise TestFailed("long('123\0') didn't raise exception")
+try: long('53', 40)
+except ValueError: pass
+else: raise TestFailed("long('53', 40) didn't raise ValueError")
+
+try: long(1, 12)
+except TypeError: pass
+else: raise TestFailed("long(1, 12) didn't raise TypeError")
+
print 'map'
if map(None, 'hello world') != ['h','e','l','l','o',' ','w','o','r','l','d']:
raise TestFailed, 'map(None, \'hello world\')'