+++ /dev/null
-from test import test_support\r
-from test.test_support import bigaddrspacetest, MAX_Py_ssize_t\r
-\r
-import unittest\r
-import operator\r
-import sys\r
-\r
-\r
-class StrTest(unittest.TestCase):\r
-\r
- @bigaddrspacetest\r
- def test_concat(self):\r
- s1 = 'x' * MAX_Py_ssize_t\r
- self.assertRaises(OverflowError, operator.add, s1, '?')\r
-\r
- @bigaddrspacetest\r
- def test_optimized_concat(self):\r
- x = 'x' * MAX_Py_ssize_t\r
- try:\r
- x = x + '?' # this statement uses a fast path in ceval.c\r
- except OverflowError:\r
- pass\r
- else:\r
- self.fail("should have raised OverflowError")\r
- try:\r
- x += '?' # this statement uses a fast path in ceval.c\r
- except OverflowError:\r
- pass\r
- else:\r
- self.fail("should have raised OverflowError")\r
- self.assertEqual(len(x), MAX_Py_ssize_t)\r
-\r
- ### the following test is pending a patch\r
- # (http://mail.python.org/pipermail/python-dev/2006-July/067774.html)\r
- #@bigaddrspacetest\r
- #def test_repeat(self):\r
- # self.assertRaises(OverflowError, operator.mul, 'x', MAX_Py_ssize_t + 1)\r
-\r
-\r
-def test_main():\r
- test_support.run_unittest(StrTest)\r
-\r
-if __name__ == '__main__':\r
- if len(sys.argv) > 1:\r
- test_support.set_memlimit(sys.argv[1])\r
- test_main()\r