summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorSkip Montanaro <skip@pobox.com>2001-10-19 16:06:52 (GMT)
committerSkip Montanaro <skip@pobox.com>2001-10-19 16:06:52 (GMT)
commit3e7bba9ac6ecfd71c5cd4e1019210ae8419e3d5e (patch)
tree186c94ee01914cfbd0aedc108fb4f4477491d035 /Lib/test
parentfdc1bd305bcf8d6ebefe98313fa6c310623a0cb9 (diff)
downloadcpython-3e7bba9ac6ecfd71c5cd4e1019210ae8419e3d5e.zip
cpython-3e7bba9ac6ecfd71c5cd4e1019210ae8419e3d5e.tar.gz
cpython-3e7bba9ac6ecfd71c5cd4e1019210ae8419e3d5e.tar.bz2
added tests for long ints and ints where they are > 32 bits.
should have been checked in as part of patch #470254.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_xmlrpc.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_xmlrpc.py b/Lib/test/test_xmlrpc.py
index 7fcfd8d..7934bc5 100644
--- a/Lib/test/test_xmlrpc.py
+++ b/Lib/test/test_xmlrpc.py
@@ -1,9 +1,12 @@
+import sys
import test_support
import unittest
import xmlrpclib
alist = [{'astring': 'foo@bar.baz.spam',
'afloat': 7283.43,
+ 'anint': 2**20,
+ 'ashortlong': 2L,
'anotherlist': ['.zyx.41'],
'abase64': xmlrpclib.Binary("my dog has fleas"),
'boolean': xmlrpclib.False,
@@ -15,6 +18,17 @@ class XMLRPCTestCase(unittest.TestCase):
self.assertEquals(alist,
xmlrpclib.loads(xmlrpclib.dumps((alist,)))[0][0])
+ def test_dump_big_long(self):
+ self.assertRaises(OverflowError, xmlrpclib.dumps, (2L**99,))
+
+ def test_dump_bad_dict(self):
+ self.assertRaises(TypeError, xmlrpclib.dumps, ({(1,2,3): 1},))
+
+ def test_dump_big_int(self):
+ if sys.maxint > 2L**31-1:
+ self.assertRaises(OverflowError, xmlrpclib.dumps,
+ (int(2L**34),))
+
def test_main():
test_support.run_unittest(XMLRPCTestCase)