Back to index

python3.2  3.2.2
Classes | Functions
test.string_tests Namespace Reference

Classes

class  Sequence
class  BadSeq1
class  BadSeq2
class  BaseTest
class  CommonTest
class  MixinStrUnicodeUserStringTest
class  MixinStrUnicodeTest

Functions

def test_replace_overflow
 ba = bytearray('a') bb = bytearray('b') EQ("bbc", "abc", "replace", ba, bb) EQ("aac", "abc", "replace", bb, ba)

Detailed Description

Common tests shared by test_str, test_unicode, test_userstring and test_string.

Function Documentation

ba = bytearray('a') bb = bytearray('b') EQ("bbc", "abc", "replace", ba, bb) EQ("aac", "abc", "replace", bb, ba)

Definition at line 612 of file string_tests.py.

00612 
00613     def test_replace_overflow(self):
00614         # Check for overflow checking on 32 bit machines
00615         if sys.maxsize != 2147483647 or struct.calcsize("P") > 4:
00616             return
00617         A2_16 = "A" * (2**16)
00618         self.checkraises(OverflowError, A2_16, "replace", "", A2_16)
00619         self.checkraises(OverflowError, A2_16, "replace", "A", A2_16)
00620         self.checkraises(OverflowError, A2_16, "replace", "AA", A2_16+A2_16)
00621 
00622