[Jython-checkins] jython: Added support for large collection literals, by setting in separate helper

jim.baker jython-checkins at python.org
Mon Oct 21 06:29:19 CEST 2013


http://hg.python.org/jython/rev/8e75d288ef32
changeset:   7136:8e75d288ef32
user:        Jim Baker <jim.baker at rackspace.com>
date:        Sun Oct 20 22:29:03 2013 -0600
summary:
  Added support for large collection literals, by setting in separate helper methods

files:
  Lib/test/test_tuple_jy.py |  19 +++++++++++++++++++
  1 files changed, 19 insertions(+), 0 deletions(-)


diff --git a/Lib/test/test_tuple_jy.py b/Lib/test/test_tuple_jy.py
new file mode 100644
--- /dev/null
+++ b/Lib/test/test_tuple_jy.py
@@ -0,0 +1,19 @@
+import unittest
+from test import test_support
+
+
+class TupleTestCase(unittest.TestCase):
+    def test_big_tuple(self):
+        """Verify that fairly large collection literals of primitives can be constructed."""
+        # use \n to separate to avoid parser problems
+        s = eval("(" + ",\n".join((str(x) for x in xrange(64000))) +")")
+        self.assertEqual(len(s), 64000)
+        self.assertEqual(sum(s), 2047968000)
+
+
+def test_main():
+    test_support.run_unittest(TupleTestCase)
+
+
+if __name__ == '__main__':
+    test_main()

-- 
Repository URL: http://hg.python.org/jython


More information about the Jython-checkins mailing list