diff options
author | Fredrik Lundh <fredrik@pythonware.com> | 2006-05-25 16:46:54 (GMT) |
---|---|---|
committer | Fredrik Lundh <fredrik@pythonware.com> | 2006-05-25 16:46:54 (GMT) |
commit | 0c71f88fc9da05517dae2d4c85a7dc059b3f1b4b (patch) | |
tree | 9dacc6c9532bf207ca554acfbcb086e51c658a4a /Lib | |
parent | 44aa9f7139bb6e05756ca156a00ca2952761fe7e (diff) | |
download | cpython-0c71f88fc9da05517dae2d4c85a7dc059b3f1b4b.zip cpython-0c71f88fc9da05517dae2d4c85a7dc059b3f1b4b.tar.gz cpython-0c71f88fc9da05517dae2d4c85a7dc059b3f1b4b.tar.bz2 |
needforspeed: check for overflow in replace (from Andrew Dalke)
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/string_tests.py | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/Lib/test/string_tests.py b/Lib/test/string_tests.py index f76a9eb..630618c 100644 --- a/Lib/test/string_tests.py +++ b/Lib/test/string_tests.py @@ -555,15 +555,14 @@ class CommonTest(unittest.TestCase): self.checkraises(TypeError, 'hello', 'replace', 42, 'h') self.checkraises(TypeError, 'hello', 'replace', 'h', 42) -### Commented out until the underlying libraries are fixed -## def test_replace_overflow(self): -## # Check for overflow checking on 32 bit machines -## if sys.maxint != 2147483647: -## return -## A2_16 = "A" * (2**16) -## self.checkraises(OverflowError, A2_16, "replace", "", A2_16) -## self.checkraises(OverflowError, A2_16, "replace", "A", A2_16) -## self.checkraises(OverflowError, A2_16, "replace", "AA", A2_16+A2_16) + def test_replace_overflow(self): + # Check for overflow checking on 32 bit machines + if sys.maxint != 2147483647: + return + A2_16 = "A" * (2**16) + self.checkraises(OverflowError, A2_16, "replace", "", A2_16) + self.checkraises(OverflowError, A2_16, "replace", "A", A2_16) + self.checkraises(OverflowError, A2_16, "replace", "AA", A2_16+A2_16) def test_zfill(self): self.checkequal('123', '123', 'zfill', 2) |