Back to index

python3.2  3.2.2
Public Member Functions
test.test_bigmem.BytesTest Class Reference
Inheritance diagram for test.test_bigmem.BytesTest:
Inheritance graph
[legend]
Collaboration diagram for test.test_bigmem.BytesTest:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def from_latin1
def test_decode
def test_capitalize
def test_center
def test_count
def test_endswith
def test_expandtabs
def test_find
def test_index
def test_isalnum
def test_isalpha
def test_isdigit
def test_islower
def test_isspace
def test_istitle
def test_isupper
def test_join
def test_ljust
def test_lower
def test_lstrip
def test_replace
def test_rfind
def test_rindex
def test_rjust
def test_rstrip
def test_split_small
def test_split_large
def test_splitlines
def test_startswith
def test_strip
def test_swapcase
def test_title
def test_translate
def test_upper
def test_zfill
def test_concat
def test_repeat
def test_slice_and_getitem
def test_contains
def test_compare
def test_hash

Detailed Description

Definition at line 707 of file test_bigmem.py.


Member Function Documentation

def test.test_bigmem.BytesTest.from_latin1 (   self,
  s 
)

Definition at line 709 of file test_bigmem.py.

00709 
00710     def from_latin1(self, s):
00711         return s.encode("latin1")

Here is the call graph for this function:

def test.test_bigmem.BaseStrTest.test_capitalize (   self,
  size 
) [inherited]

Definition at line 46 of file test_bigmem.py.

00046 
00047     def test_capitalize(self, size):
00048         _ = self.from_latin1
00049         SUBSTR = self.from_latin1(' abc def ghi')
00050         s = _('-') * size + SUBSTR
00051         caps = s.capitalize()
00052         self.assertEqual(caps[-len(SUBSTR):],
00053                          SUBSTR.capitalize())
00054         self.assertEqual(caps.lstrip(_('-')), SUBSTR)

Here is the call graph for this function:

def test.test_bigmem.BaseStrTest.test_center (   self,
  size 
) [inherited]

Definition at line 56 of file test_bigmem.py.

00056 
00057     def test_center(self, size):
00058         SUBSTR = self.from_latin1(' abc def ghi')
00059         s = SUBSTR.center(size)
00060         self.assertEqual(len(s), size)
00061         lpadsize = rpadsize = (len(s) - len(SUBSTR)) // 2
00062         if len(s) % 2:
00063             lpadsize += 1
00064         self.assertEqual(s[lpadsize:-rpadsize], SUBSTR)
00065         self.assertEqual(s.strip(), SUBSTR.strip())

Here is the call graph for this function:

def test.test_bigmem.BaseStrTest.test_compare (   self,
  size 
) [inherited]

Definition at line 530 of file test_bigmem.py.

00530 
00531     def test_compare(self, size):
00532         _ = self.from_latin1
00533         s1 = _('-') * size
00534         s2 = _('-') * size
00535         self.assertEqual(s1, s2)
00536         del s2
00537         s2 = s1 + _('a')
00538         self.assertFalse(s1 == s2)
00539         del s2
00540         s2 = _('.') * size
00541         self.assertFalse(s1 == s2)

Here is the call graph for this function:

def test.test_bigmem.BaseStrTest.test_concat (   self,
  size 
) [inherited]

Definition at line 462 of file test_bigmem.py.

00462 
00463     def test_concat(self, size):
00464         _ = self.from_latin1
00465         s = _('.') * size
00466         self.assertEqual(len(s), size)
00467         s = s + s
00468         self.assertEqual(len(s), size * 2)
00469         self.assertEqual(s.count(_('.')), size * 2)

Here is the call graph for this function:

def test.test_bigmem.BaseStrTest.test_contains (   self,
  size 
) [inherited]

Definition at line 516 of file test_bigmem.py.

00516 
00517     def test_contains(self, size):
00518         _ = self.from_latin1
00519         SUBSTR = _('0123456789')
00520         edge = _('-') * (size // 2)
00521         s = _('').join([edge, SUBSTR, edge])
00522         del edge
00523         self.assertIn(SUBSTR, s)
00524         self.assertNotIn(SUBSTR * 2, s)
00525         self.assertIn(_('-'), s)
00526         self.assertNotIn(_('a'), s)
00527         s += _('a')
00528         self.assertIn(_('a'), s)

Here is the call graph for this function:

def test.test_bigmem.BaseStrTest.test_count (   self,
  size 
) [inherited]

Definition at line 67 of file test_bigmem.py.

00067 
00068     def test_count(self, size):
00069         _ = self.from_latin1
00070         SUBSTR = _(' abc def ghi')
00071         s = _('.') * size + SUBSTR
00072         self.assertEqual(s.count(_('.')), size)
00073         s += _('.')
00074         self.assertEqual(s.count(_('.')), size + 1)
00075         self.assertEqual(s.count(_(' ')), 3)
00076         self.assertEqual(s.count(_('i')), 1)
00077         self.assertEqual(s.count(_('j')), 0)

Here is the call graph for this function:

def test.test_bigmem.BytesTest.test_decode (   self,
  size 
)

Definition at line 713 of file test_bigmem.py.

00713 
00714     def test_decode(self, size):
00715         s = self.from_latin1('.') * size
00716         self.assertEqual(len(s.decode('utf-8')), size)
00717 

Here is the call graph for this function:

def test.test_bigmem.BaseStrTest.test_endswith (   self,
  size 
) [inherited]

Definition at line 79 of file test_bigmem.py.

00079 
00080     def test_endswith(self, size):
00081         _ = self.from_latin1
00082         SUBSTR = _(' abc def ghi')
00083         s = _('-') * size + SUBSTR
00084         self.assertTrue(s.endswith(SUBSTR))
00085         self.assertTrue(s.endswith(s))
00086         s2 = _('...') + s
00087         self.assertTrue(s2.endswith(s))
00088         self.assertFalse(s.endswith(_('a') + SUBSTR))
00089         self.assertFalse(SUBSTR.endswith(s))

Here is the call graph for this function:

def test.test_bigmem.BaseStrTest.test_expandtabs (   self,
  size 
) [inherited]

Definition at line 91 of file test_bigmem.py.

00091 
00092     def test_expandtabs(self, size):
00093         _ = self.from_latin1
00094         s = _('-') * size
00095         tabsize = 8
00096         self.assertEqual(s.expandtabs(), s)
00097         del s
00098         slen, remainder = divmod(size, tabsize)
00099         s = _('       \t') * slen
00100         s = s.expandtabs(tabsize)
00101         self.assertEqual(len(s), size - remainder)
00102         self.assertEqual(len(s.strip(_(' '))), 0)

Here is the call graph for this function:

def test.test_bigmem.BaseStrTest.test_find (   self,
  size 
) [inherited]

Definition at line 104 of file test_bigmem.py.

00104 
00105     def test_find(self, size):
00106         _ = self.from_latin1
00107         SUBSTR = _(' abc def ghi')
00108         sublen = len(SUBSTR)
00109         s = _('').join([SUBSTR, _('-') * size, SUBSTR])
00110         self.assertEqual(s.find(_(' ')), 0)
00111         self.assertEqual(s.find(SUBSTR), 0)
00112         self.assertEqual(s.find(_(' '), sublen), sublen + size)
00113         self.assertEqual(s.find(SUBSTR, len(SUBSTR)), sublen + size)
00114         self.assertEqual(s.find(_('i')), SUBSTR.find(_('i')))
00115         self.assertEqual(s.find(_('i'), sublen),
00116                          sublen + size + SUBSTR.find(_('i')))
00117         self.assertEqual(s.find(_('i'), size),
00118                          sublen + size + SUBSTR.find(_('i')))
00119         self.assertEqual(s.find(_('j')), -1)

Here is the call graph for this function:

def test.test_bigmem.BaseStrTest.test_hash (   self,
  size 
) [inherited]

Definition at line 543 of file test_bigmem.py.

00543 
00544     def test_hash(self, size):
00545         # Not sure if we can do any meaningful tests here...  Even if we
00546         # start relying on the exact algorithm used, the result will be
00547         # different depending on the size of the C 'long int'.  Even this
00548         # test is dodgy (there's no *guarantee* that the two things should
00549         # have a different hash, even if they, in the current
00550         # implementation, almost always do.)
00551         _ = self.from_latin1
00552         s = _('\x00') * size
00553         h1 = hash(s)
00554         del s
00555         s = _('\x00') * (size + 1)
00556         self.assertFalse(h1 == hash(s))
00557 

Here is the call graph for this function:

def test.test_bigmem.BaseStrTest.test_index (   self,
  size 
) [inherited]

Definition at line 121 of file test_bigmem.py.

00121 
00122     def test_index(self, size):
00123         _ = self.from_latin1
00124         SUBSTR = _(' abc def ghi')
00125         sublen = len(SUBSTR)
00126         s = _('').join([SUBSTR, _('-') * size, SUBSTR])
00127         self.assertEqual(s.index(_(' ')), 0)
00128         self.assertEqual(s.index(SUBSTR), 0)
00129         self.assertEqual(s.index(_(' '), sublen), sublen + size)
00130         self.assertEqual(s.index(SUBSTR, sublen), sublen + size)
00131         self.assertEqual(s.index(_('i')), SUBSTR.index(_('i')))
00132         self.assertEqual(s.index(_('i'), sublen),
00133                          sublen + size + SUBSTR.index(_('i')))
00134         self.assertEqual(s.index(_('i'), size),
00135                          sublen + size + SUBSTR.index(_('i')))
00136         self.assertRaises(ValueError, s.index, _('j'))

Here is the call graph for this function:

def test.test_bigmem.BaseStrTest.test_isalnum (   self,
  size 
) [inherited]

Definition at line 138 of file test_bigmem.py.

00138 
00139     def test_isalnum(self, size):
00140         _ = self.from_latin1
00141         SUBSTR = _('123456')
00142         s = _('a') * size + SUBSTR
00143         self.assertTrue(s.isalnum())
00144         s += _('.')
00145         self.assertFalse(s.isalnum())

Here is the call graph for this function:

def test.test_bigmem.BaseStrTest.test_isalpha (   self,
  size 
) [inherited]

Definition at line 147 of file test_bigmem.py.

00147 
00148     def test_isalpha(self, size):
00149         _ = self.from_latin1
00150         SUBSTR = _('zzzzzzz')
00151         s = _('a') * size + SUBSTR
00152         self.assertTrue(s.isalpha())
00153         s += _('.')
00154         self.assertFalse(s.isalpha())

Here is the call graph for this function:

def test.test_bigmem.BaseStrTest.test_isdigit (   self,
  size 
) [inherited]

Definition at line 156 of file test_bigmem.py.

00156 
00157     def test_isdigit(self, size):
00158         _ = self.from_latin1
00159         SUBSTR = _('123456')
00160         s = _('9') * size + SUBSTR
00161         self.assertTrue(s.isdigit())
00162         s += _('z')
00163         self.assertFalse(s.isdigit())

Here is the call graph for this function:

def test.test_bigmem.BaseStrTest.test_islower (   self,
  size 
) [inherited]

Definition at line 165 of file test_bigmem.py.

00165 
00166     def test_islower(self, size):
00167         _ = self.from_latin1
00168         chars = _(''.join(
00169             chr(c) for c in range(255) if not chr(c).isupper()))
00170         repeats = size // len(chars) + 2
00171         s = chars * repeats
00172         self.assertTrue(s.islower())
00173         s += _('A')
00174         self.assertFalse(s.islower())

Here is the call graph for this function:

def test.test_bigmem.BaseStrTest.test_isspace (   self,
  size 
) [inherited]

Definition at line 176 of file test_bigmem.py.

00176 
00177     def test_isspace(self, size):
00178         _ = self.from_latin1
00179         whitespace = _(' \f\n\r\t\v')
00180         repeats = size // len(whitespace) + 2
00181         s = whitespace * repeats
00182         self.assertTrue(s.isspace())
00183         s += _('j')
00184         self.assertFalse(s.isspace())

Here is the call graph for this function:

def test.test_bigmem.BaseStrTest.test_istitle (   self,
  size 
) [inherited]

Definition at line 186 of file test_bigmem.py.

00186 
00187     def test_istitle(self, size):
00188         _ = self.from_latin1
00189         SUBSTR = _('123456')
00190         s = _('').join([_('A'), _('a') * size, SUBSTR])
00191         self.assertTrue(s.istitle())
00192         s += _('A')
00193         self.assertTrue(s.istitle())
00194         s += _('aA')
00195         self.assertFalse(s.istitle())

Here is the call graph for this function:

def test.test_bigmem.BaseStrTest.test_isupper (   self,
  size 
) [inherited]

Definition at line 197 of file test_bigmem.py.

00197 
00198     def test_isupper(self, size):
00199         _ = self.from_latin1
00200         chars = _(''.join(
00201             chr(c) for c in range(255) if not chr(c).islower()))
00202         repeats = size // len(chars) + 2
00203         s = chars * repeats
00204         self.assertTrue(s.isupper())
00205         s += _('a')
00206         self.assertFalse(s.isupper())

Here is the call graph for this function:

def test.test_bigmem.BaseStrTest.test_join (   self,
  size 
) [inherited]

Definition at line 208 of file test_bigmem.py.

00208 
00209     def test_join(self, size):
00210         _ = self.from_latin1
00211         s = _('A') * size
00212         x = s.join([_('aaaaa'), _('bbbbb')])
00213         self.assertEqual(x.count(_('a')), 5)
00214         self.assertEqual(x.count(_('b')), 5)
00215         self.assertTrue(x.startswith(_('aaaaaA')))
00216         self.assertTrue(x.endswith(_('Abbbbb')))

Here is the call graph for this function:

def test.test_bigmem.BaseStrTest.test_ljust (   self,
  size 
) [inherited]

Definition at line 218 of file test_bigmem.py.

00218 
00219     def test_ljust(self, size):
00220         _ = self.from_latin1
00221         SUBSTR = _(' abc def ghi')
00222         s = SUBSTR.ljust(size)
00223         self.assertTrue(s.startswith(SUBSTR + _('  ')))
00224         self.assertEqual(len(s), size)
00225         self.assertEqual(s.strip(), SUBSTR.strip())

Here is the call graph for this function:

def test.test_bigmem.BaseStrTest.test_lower (   self,
  size 
) [inherited]

Definition at line 227 of file test_bigmem.py.

00227 
00228     def test_lower(self, size):
00229         _ = self.from_latin1
00230         s = _('A') * size
00231         s = s.lower()
00232         self.assertEqual(len(s), size)
00233         self.assertEqual(s.count(_('a')), size)

Here is the call graph for this function:

def test.test_bigmem.BaseStrTest.test_lstrip (   self,
  size 
) [inherited]

Definition at line 235 of file test_bigmem.py.

00235 
00236     def test_lstrip(self, size):
00237         _ = self.from_latin1
00238         SUBSTR = _('abc def ghi')
00239         s = SUBSTR.rjust(size)
00240         self.assertEqual(len(s), size)
00241         self.assertEqual(s.lstrip(), SUBSTR.lstrip())
00242         del s
00243         s = SUBSTR.ljust(size)
00244         self.assertEqual(len(s), size)
00245         # Type-specific optimization
00246         if isinstance(s, (str, bytes)):
00247             stripped = s.lstrip()
00248             self.assertTrue(stripped is s)

Here is the call graph for this function:

def test.test_bigmem.BaseStrTest.test_repeat (   self,
  size 
) [inherited]

Definition at line 473 of file test_bigmem.py.

00473 
00474     def test_repeat(self, size):
00475         _ = self.from_latin1
00476         s = _('.') * size
00477         self.assertEqual(len(s), size)
00478         s = s * 2
00479         self.assertEqual(len(s), size * 2)
00480         self.assertEqual(s.count(_('.')), size * 2)

Here is the call graph for this function:

def test.test_bigmem.BaseStrTest.test_replace (   self,
  size 
) [inherited]

Definition at line 250 of file test_bigmem.py.

00250 
00251     def test_replace(self, size):
00252         _ = self.from_latin1
00253         replacement = _('a')
00254         s = _(' ') * size
00255         s = s.replace(_(' '), replacement)
00256         self.assertEqual(len(s), size)
00257         self.assertEqual(s.count(replacement), size)
00258         s = s.replace(replacement, _(' '), size - 4)
00259         self.assertEqual(len(s), size)
00260         self.assertEqual(s.count(replacement), 4)
00261         self.assertEqual(s[-10:], _('      aaaa'))

Here is the call graph for this function:

def test.test_bigmem.BaseStrTest.test_rfind (   self,
  size 
) [inherited]

Definition at line 263 of file test_bigmem.py.

00263 
00264     def test_rfind(self, size):
00265         _ = self.from_latin1
00266         SUBSTR = _(' abc def ghi')
00267         sublen = len(SUBSTR)
00268         s = _('').join([SUBSTR, _('-') * size, SUBSTR])
00269         self.assertEqual(s.rfind(_(' ')), sublen + size + SUBSTR.rfind(_(' ')))
00270         self.assertEqual(s.rfind(SUBSTR), sublen + size)
00271         self.assertEqual(s.rfind(_(' '), 0, size), SUBSTR.rfind(_(' ')))
00272         self.assertEqual(s.rfind(SUBSTR, 0, sublen + size), 0)
00273         self.assertEqual(s.rfind(_('i')), sublen + size + SUBSTR.rfind(_('i')))
00274         self.assertEqual(s.rfind(_('i'), 0, sublen), SUBSTR.rfind(_('i')))
00275         self.assertEqual(s.rfind(_('i'), 0, sublen + size),
00276                          SUBSTR.rfind(_('i')))
00277         self.assertEqual(s.rfind(_('j')), -1)

Here is the call graph for this function:

def test.test_bigmem.BaseStrTest.test_rindex (   self,
  size 
) [inherited]

Definition at line 279 of file test_bigmem.py.

00279 
00280     def test_rindex(self, size):
00281         _ = self.from_latin1
00282         SUBSTR = _(' abc def ghi')
00283         sublen = len(SUBSTR)
00284         s = _('').join([SUBSTR, _('-') * size, SUBSTR])
00285         self.assertEqual(s.rindex(_(' ')),
00286                          sublen + size + SUBSTR.rindex(_(' ')))
00287         self.assertEqual(s.rindex(SUBSTR), sublen + size)
00288         self.assertEqual(s.rindex(_(' '), 0, sublen + size - 1),
00289                          SUBSTR.rindex(_(' ')))
00290         self.assertEqual(s.rindex(SUBSTR, 0, sublen + size), 0)
00291         self.assertEqual(s.rindex(_('i')),
00292                          sublen + size + SUBSTR.rindex(_('i')))
00293         self.assertEqual(s.rindex(_('i'), 0, sublen), SUBSTR.rindex(_('i')))
00294         self.assertEqual(s.rindex(_('i'), 0, sublen + size),
00295                          SUBSTR.rindex(_('i')))
00296         self.assertRaises(ValueError, s.rindex, _('j'))

Here is the call graph for this function:

def test.test_bigmem.BaseStrTest.test_rjust (   self,
  size 
) [inherited]

Definition at line 298 of file test_bigmem.py.

00298 
00299     def test_rjust(self, size):
00300         _ = self.from_latin1
00301         SUBSTR = _(' abc def ghi')
00302         s = SUBSTR.ljust(size)
00303         self.assertTrue(s.startswith(SUBSTR + _('  ')))
00304         self.assertEqual(len(s), size)
00305         self.assertEqual(s.strip(), SUBSTR.strip())

Here is the call graph for this function:

def test.test_bigmem.BaseStrTest.test_rstrip (   self,
  size 
) [inherited]

Definition at line 307 of file test_bigmem.py.

00307 
00308     def test_rstrip(self, size):
00309         _ = self.from_latin1
00310         SUBSTR = _(' abc def ghi')
00311         s = SUBSTR.ljust(size)
00312         self.assertEqual(len(s), size)
00313         self.assertEqual(s.rstrip(), SUBSTR.rstrip())
00314         del s
00315         s = SUBSTR.rjust(size)
00316         self.assertEqual(len(s), size)
00317         # Type-specific optimization
00318         if isinstance(s, (str, bytes)):
00319             stripped = s.rstrip()
00320             self.assertTrue(stripped is s)

Here is the call graph for this function:

def test.test_bigmem.BaseStrTest.test_slice_and_getitem (   self,
  size 
) [inherited]

Definition at line 482 of file test_bigmem.py.

00482 
00483     def test_slice_and_getitem(self, size):
00484         _ = self.from_latin1
00485         SUBSTR = _('0123456789')
00486         sublen = len(SUBSTR)
00487         s = SUBSTR * (size // sublen)
00488         stepsize = len(s) // 100
00489         stepsize = stepsize - (stepsize % sublen)
00490         for i in range(0, len(s) - stepsize, stepsize):
00491             self.assertEqual(s[i], SUBSTR[0])
00492             self.assertEqual(s[i:i + sublen], SUBSTR)
00493             self.assertEqual(s[i:i + sublen:2], SUBSTR[::2])
00494             if i > 0:
00495                 self.assertEqual(s[i + sublen - 1:i - 1:-3],
00496                                  SUBSTR[sublen::-3])
00497         # Make sure we do some slicing and indexing near the end of the
00498         # string, too.
00499         self.assertEqual(s[len(s) - 1], SUBSTR[-1])
00500         self.assertEqual(s[-1], SUBSTR[-1])
00501         self.assertEqual(s[len(s) - 10], SUBSTR[0])
00502         self.assertEqual(s[-sublen], SUBSTR[0])
00503         self.assertEqual(s[len(s):], _(''))
00504         self.assertEqual(s[len(s) - 1:], SUBSTR[-1:])
00505         self.assertEqual(s[-1:], SUBSTR[-1:])
00506         self.assertEqual(s[len(s) - sublen:], SUBSTR)
00507         self.assertEqual(s[-sublen:], SUBSTR)
00508         self.assertEqual(len(s[:]), len(s))
00509         self.assertEqual(len(s[:len(s) - 5]), len(s) - 5)
00510         self.assertEqual(len(s[5:-5]), len(s) - 10)
00511 
00512         self.assertRaises(IndexError, operator.getitem, s, len(s))
00513         self.assertRaises(IndexError, operator.getitem, s, len(s) + 1)
00514         self.assertRaises(IndexError, operator.getitem, s, len(s) + 1<<31)

Here is the call graph for this function:

def test.test_bigmem.BaseStrTest.test_split_large (   self,
  size 
) [inherited]

Definition at line 351 of file test_bigmem.py.

00351 
00352     def test_split_large(self, size):
00353         _ = self.from_latin1
00354         s = _(' a') * size + _(' ')
00355         l = s.split()
00356         self.assertEqual(len(l), size)
00357         self.assertEqual(set(l), set([_('a')]))
00358         del l
00359         l = s.split(_('a'))
00360         self.assertEqual(len(l), size + 1)
00361         self.assertEqual(set(l), set([_(' ')]))

Here is the call graph for this function:

def test.test_bigmem.BaseStrTest.test_split_small (   self,
  size 
) [inherited]

Definition at line 325 of file test_bigmem.py.

00325 
00326     def test_split_small(self, size):
00327         _ = self.from_latin1
00328         # Crudely calculate an estimate so that the result of s.split won't
00329         # take up an inordinate amount of memory
00330         chunksize = int(size ** 0.5 + 2)
00331         SUBSTR = _('a') + _(' ') * chunksize
00332         s = SUBSTR * chunksize
00333         l = s.split()
00334         self.assertEqual(len(l), chunksize)
00335         expected = _('a')
00336         for item in l:
00337             self.assertEqual(item, expected)
00338         del l
00339         l = s.split(_('a'))
00340         self.assertEqual(len(l), chunksize + 1)
00341         expected = _(' ') * chunksize
00342         for item in filter(None, l):
00343             self.assertEqual(item, expected)

Here is the call graph for this function:

def test.test_bigmem.BaseStrTest.test_splitlines (   self,
  size 
) [inherited]

Definition at line 363 of file test_bigmem.py.

00363 
00364     def test_splitlines(self, size):
00365         _ = self.from_latin1
00366         # Crudely calculate an estimate so that the result of s.split won't
00367         # take up an inordinate amount of memory
00368         chunksize = int(size ** 0.5 + 2) // 2
00369         SUBSTR = _(' ') * chunksize + _('\n') + _(' ') * chunksize + _('\r\n')
00370         s = SUBSTR * chunksize
00371         l = s.splitlines()
00372         self.assertEqual(len(l), chunksize * 2)
00373         expected = _(' ') * chunksize
00374         for item in l:
00375             self.assertEqual(item, expected)

Here is the call graph for this function:

def test.test_bigmem.BaseStrTest.test_startswith (   self,
  size 
) [inherited]

Definition at line 377 of file test_bigmem.py.

00377 
00378     def test_startswith(self, size):
00379         _ = self.from_latin1
00380         SUBSTR = _(' abc def ghi')
00381         s = _('-') * size + SUBSTR
00382         self.assertTrue(s.startswith(s))
00383         self.assertTrue(s.startswith(_('-') * size))
00384         self.assertFalse(s.startswith(SUBSTR))

Here is the call graph for this function:

def test.test_bigmem.BaseStrTest.test_strip (   self,
  size 
) [inherited]

Definition at line 386 of file test_bigmem.py.

00386 
00387     def test_strip(self, size):
00388         _ = self.from_latin1
00389         SUBSTR = _('   abc def ghi   ')
00390         s = SUBSTR.rjust(size)
00391         self.assertEqual(len(s), size)
00392         self.assertEqual(s.strip(), SUBSTR.strip())
00393         del s
00394         s = SUBSTR.ljust(size)
00395         self.assertEqual(len(s), size)
00396         self.assertEqual(s.strip(), SUBSTR.strip())

Here is the call graph for this function:

def test.test_bigmem.BaseStrTest.test_swapcase (   self,
  size 
) [inherited]

Definition at line 398 of file test_bigmem.py.

00398 
00399     def test_swapcase(self, size):
00400         _ = self.from_latin1
00401         SUBSTR = _("aBcDeFG12.'\xa9\x00")
00402         sublen = len(SUBSTR)
00403         repeats = size // sublen + 2
00404         s = SUBSTR * repeats
00405         s = s.swapcase()
00406         self.assertEqual(len(s), sublen * repeats)
00407         self.assertEqual(s[:sublen * 3], SUBSTR.swapcase() * 3)
00408         self.assertEqual(s[-sublen * 3:], SUBSTR.swapcase() * 3)

Here is the call graph for this function:

def test.test_bigmem.BaseStrTest.test_title (   self,
  size 
) [inherited]

Definition at line 410 of file test_bigmem.py.

00410 
00411     def test_title(self, size):
00412         _ = self.from_latin1
00413         SUBSTR = _('SpaaHAaaAaham')
00414         s = SUBSTR * (size // len(SUBSTR) + 2)
00415         s = s.title()
00416         self.assertTrue(s.startswith((SUBSTR * 3).title()))
00417         self.assertTrue(s.endswith(SUBSTR.lower() * 3))

Here is the call graph for this function:

def test.test_bigmem.BaseStrTest.test_translate (   self,
  size 
) [inherited]

Definition at line 419 of file test_bigmem.py.

00419 
00420     def test_translate(self, size):
00421         _ = self.from_latin1
00422         SUBSTR = _('aZz.z.Aaz.')
00423         if isinstance(SUBSTR, str):
00424             trans = {
00425                 ord(_('.')): _('-'),
00426                 ord(_('a')): _('!'),
00427                 ord(_('Z')): _('$'),
00428             }
00429         else:
00430             trans = bytes.maketrans(b'.aZ', b'-!$')
00431         sublen = len(SUBSTR)
00432         repeats = size // sublen + 2
00433         s = SUBSTR * repeats
00434         s = s.translate(trans)
00435         self.assertEqual(len(s), repeats * sublen)
00436         self.assertEqual(s[:sublen], SUBSTR.translate(trans))
00437         self.assertEqual(s[-sublen:], SUBSTR.translate(trans))
00438         self.assertEqual(s.count(_('.')), 0)
00439         self.assertEqual(s.count(_('!')), repeats * 2)
00440         self.assertEqual(s.count(_('z')), repeats * 3)

Here is the call graph for this function:

def test.test_bigmem.BaseStrTest.test_upper (   self,
  size 
) [inherited]

Definition at line 442 of file test_bigmem.py.

00442 
00443     def test_upper(self, size):
00444         _ = self.from_latin1
00445         s = _('a') * size
00446         s = s.upper()
00447         self.assertEqual(len(s), size)
00448         self.assertEqual(s.count(_('A')), size)

Here is the call graph for this function:

def test.test_bigmem.BaseStrTest.test_zfill (   self,
  size 
) [inherited]

Definition at line 450 of file test_bigmem.py.

00450 
00451     def test_zfill(self, size):
00452         _ = self.from_latin1
00453         SUBSTR = _('-568324723598234')
00454         s = SUBSTR.zfill(size)
00455         self.assertTrue(s.endswith(_('0') + SUBSTR[1:]))
00456         self.assertTrue(s.startswith(_('-0')))
00457         self.assertEqual(len(s), size)
00458         self.assertEqual(s.count(_('0')), size - len(SUBSTR))

Here is the call graph for this function:


The documentation for this class was generated from the following file: