• Home
  • Raw
  • Download

Lines Matching refs:checkequal

52     def checkequal(self, result, object, methodname, *args):  member in CommonTest
94 self.checkequal(' hello ', ' hello ', 'capitalize')
95 self.checkequal('Hello ', 'Hello ','capitalize')
96 self.checkequal('Hello ', 'hello ','capitalize')
97 self.checkequal('Aaaa', 'aaaa', 'capitalize')
98 self.checkequal('Aaaa', 'AaAa', 'capitalize')
103 self.checkequal(3, 'aaa', 'count', 'a')
104 self.checkequal(0, 'aaa', 'count', 'b')
105 self.checkequal(3, 'aaa', 'count', 'a')
106 self.checkequal(0, 'aaa', 'count', 'b')
107 self.checkequal(3, 'aaa', 'count', 'a')
108 self.checkequal(0, 'aaa', 'count', 'b')
109 self.checkequal(0, 'aaa', 'count', 'b')
110 self.checkequal(2, 'aaa', 'count', 'a', 1)
111 self.checkequal(0, 'aaa', 'count', 'a', 10)
112 self.checkequal(1, 'aaa', 'count', 'a', -1)
113 self.checkequal(3, 'aaa', 'count', 'a', -10)
114 self.checkequal(1, 'aaa', 'count', 'a', 0, 1)
115 self.checkequal(3, 'aaa', 'count', 'a', 0, 10)
116 self.checkequal(2, 'aaa', 'count', 'a', 0, -1)
117 self.checkequal(0, 'aaa', 'count', 'a', 0, -10)
118 self.checkequal(3, 'aaa', 'count', '', 1)
119 self.checkequal(1, 'aaa', 'count', '', 3)
120 self.checkequal(0, 'aaa', 'count', '', 10)
121 self.checkequal(2, 'aaa', 'count', '', -1)
122 self.checkequal(4, 'aaa', 'count', '', -10)
124 self.checkequal(1, '', 'count', '')
125 self.checkequal(0, '', 'count', '', 1, 1)
126 self.checkequal(0, '', 'count', '', sys.maxint, 0)
128 self.checkequal(0, '', 'count', 'xx')
129 self.checkequal(0, '', 'count', 'xx', 1, 1)
130 self.checkequal(0, '', 'count', 'xx', sys.maxint, 0)
163 self.checkequal(0, 'abcdefghiabc', 'find', 'abc')
164 self.checkequal(9, 'abcdefghiabc', 'find', 'abc', 1)
165 self.checkequal(-1, 'abcdefghiabc', 'find', 'def', 4)
167 self.checkequal(0, 'abc', 'find', '', 0)
168 self.checkequal(3, 'abc', 'find', '', 3)
169 self.checkequal(-1, 'abc', 'find', '', 4)
172 self.checkequal( 2, 'rrarrrrrrrrra', 'find', 'a')
173 self.checkequal(12, 'rrarrrrrrrrra', 'find', 'a', 4)
174 self.checkequal(-1, 'rrarrrrrrrrra', 'find', 'a', 4, 6)
175 self.checkequal(12, 'rrarrrrrrrrra', 'find', 'a', 4, None)
176 self.checkequal( 2, 'rrarrrrrrrrra', 'find', 'a', None, 6)
181 self.checkequal(0, '', 'find', '')
182 self.checkequal(-1, '', 'find', '', 1, 1)
183 self.checkequal(-1, '', 'find', '', sys.maxint, 0)
185 self.checkequal(-1, '', 'find', 'xx')
186 self.checkequal(-1, '', 'find', 'xx', 1, 1)
187 self.checkequal(-1, '', 'find', 'xx', sys.maxint, 0)
190 self.checkequal(-1, 'ab', 'find', 'xxx', sys.maxsize + 1, 0)
217 self.checkequal(9, 'abcdefghiabc', 'rfind', 'abc')
218 self.checkequal(12, 'abcdefghiabc', 'rfind', '')
219 self.checkequal(0, 'abcdefghiabc', 'rfind', 'abcd')
220 self.checkequal(-1, 'abcdefghiabc', 'rfind', 'abcz')
222 self.checkequal(3, 'abc', 'rfind', '', 0)
223 self.checkequal(3, 'abc', 'rfind', '', 3)
224 self.checkequal(-1, 'abc', 'rfind', '', 4)
227 self.checkequal(12, 'rrarrrrrrrrra', 'rfind', 'a')
228 self.checkequal(12, 'rrarrrrrrrrra', 'rfind', 'a', 4)
229 self.checkequal(-1, 'rrarrrrrrrrra', 'rfind', 'a', 4, 6)
230 self.checkequal(12, 'rrarrrrrrrrra', 'rfind', 'a', 4, None)
231 self.checkequal( 2, 'rrarrrrrrrrra', 'rfind', 'a', None, 6)
261 self.checkequal(-1, 'ab', 'rfind', 'xxx', sys.maxsize + 1, 0)
264 self.checkequal(0, 'abcdefghiabc', 'index', '')
265 self.checkequal(3, 'abcdefghiabc', 'index', 'def')
266 self.checkequal(0, 'abcdefghiabc', 'index', 'abc')
267 self.checkequal(9, 'abcdefghiabc', 'index', 'abc', 1)
275 self.checkequal( 2, 'rrarrrrrrrrra', 'index', 'a')
276 self.checkequal(12, 'rrarrrrrrrrra', 'index', 'a', 4)
278 self.checkequal(12, 'rrarrrrrrrrra', 'index', 'a', 4, None)
279 self.checkequal( 2, 'rrarrrrrrrrra', 'index', 'a', None, 6)
285 self.checkequal(12, 'abcdefghiabc', 'rindex', '')
286 self.checkequal(3, 'abcdefghiabc', 'rindex', 'def')
287 self.checkequal(9, 'abcdefghiabc', 'rindex', 'abc')
288 self.checkequal(0, 'abcdefghiabc', 'rindex', 'abc', 0, -1)
297 self.checkequal(12, 'rrarrrrrrrrra', 'rindex', 'a')
298 self.checkequal(12, 'rrarrrrrrrrra', 'rindex', 'a', 4)
300 self.checkequal(12, 'rrarrrrrrrrra', 'rindex', 'a', 4, None)
301 self.checkequal( 2, 'rrarrrrrrrrra', 'rindex', 'a', None, 6)
307 self.checkequal('hello', 'HeLLo', 'lower')
308 self.checkequal('hello', 'hello', 'lower')
312 self.checkequal('HELLO', 'HeLLo', 'upper')
313 self.checkequal('HELLO', 'HELLO', 'upper')
317 self.checkequal('abc\rab def\ng hi', 'abc\rab\tdef\ng\thi', 'expandtabs')
318 self.checkequal('abc\rab def\ng hi', 'abc\rab\tdef\ng\thi', 'expandtabs', 8)
319 self.checkequal('abc\rab def\ng hi', 'abc\rab\tdef\ng\thi', 'expandtabs', 4)
320 self.checkequal('abc\r\nab def\ng hi', 'abc\r\nab\tdef\ng\thi', 'expandtabs', 4)
321 self.checkequal('abc\rab def\ng hi', 'abc\rab\tdef\ng\thi', 'expandtabs')
322 self.checkequal('abc\rab def\ng hi', 'abc\rab\tdef\ng\thi', 'expandtabs', 8)
323 self.checkequal('abc\r\nab\r\ndef\ng\r\nhi', 'abc\r\nab\r\ndef\ng\r\nhi', 'expandtabs', 4)
324 self.checkequal(' a\n b', ' \ta\n\tb', 'expandtabs', 1)
333 self.checkequal(['this', 'is', 'the', 'split', 'function'],
337 self.checkequal(['a', 'b', 'c', 'd'], 'a b c d ', 'split')
338 self.checkequal(['a', 'b c d'], 'a b c d', 'split', None, 1)
339 self.checkequal(['a', 'b', 'c d'], 'a b c d', 'split', None, 2)
340 self.checkequal(['a', 'b', 'c', 'd'], 'a b c d', 'split', None, 3)
341 self.checkequal(['a', 'b', 'c', 'd'], 'a b c d', 'split', None, 4)
342 self.checkequal(['a', 'b', 'c', 'd'], 'a b c d', 'split', None,
344 self.checkequal(['a b c d'], 'a b c d', 'split', None, 0)
345 self.checkequal(['a b c d'], ' a b c d', 'split', None, 0)
346 self.checkequal(['a', 'b', 'c d'], 'a b c d', 'split', None, 2)
348 self.checkequal([], ' ', 'split')
349 self.checkequal(['a'], ' a ', 'split')
350 self.checkequal(['a', 'b'], ' a b ', 'split')
351 self.checkequal(['a', 'b '], ' a b ', 'split', None, 1)
352 self.checkequal(['a b c '], ' a b c ', 'split', None, 0)
353 self.checkequal(['a', 'b c '], ' a b c ', 'split', None, 1)
354 self.checkequal(['a', 'b', 'c '], ' a b c ', 'split', None, 2)
355 self.checkequal(['a', 'b', 'c'], ' a b c ', 'split', None, 3)
356 self.checkequal(['a', 'b'], '\n\ta \t\r b \v ', 'split')
358 self.checkequal(['a']*20, aaa, 'split')
359 self.checkequal(['a'] + [aaa[4:]], aaa, 'split', None, 1)
360 self.checkequal(['a']*19 + ['a '], aaa, 'split', None, 19)
364 self.checkequal(['arf', 'barf'], b, 'split')
365 self.checkequal(['arf', 'barf'], b, 'split', None)
366 self.checkequal(['arf', 'barf'], b, 'split', None, 2)
369 self.checkequal(['a', 'b', 'c', 'd'], 'a|b|c|d', 'split', '|')
370 self.checkequal(['a|b|c|d'], 'a|b|c|d', 'split', '|', 0)
371 self.checkequal(['a', 'b|c|d'], 'a|b|c|d', 'split', '|', 1)
372 self.checkequal(['a', 'b', 'c|d'], 'a|b|c|d', 'split', '|', 2)
373 self.checkequal(['a', 'b', 'c', 'd'], 'a|b|c|d', 'split', '|', 3)
374 self.checkequal(['a', 'b', 'c', 'd'], 'a|b|c|d', 'split', '|', 4)
375 self.checkequal(['a', 'b', 'c', 'd'], 'a|b|c|d', 'split', '|',
377 self.checkequal(['a|b|c|d'], 'a|b|c|d', 'split', '|', 0)
378 self.checkequal(['a', '', 'b||c||d'], 'a||b||c||d', 'split', '|', 2)
379 self.checkequal(['abcd'], 'abcd', 'split', '|')
380 self.checkequal([''], '', 'split', '|')
381 self.checkequal(['endcase ', ''], 'endcase |', 'split', '|')
382 self.checkequal(['', ' startcase'], '| startcase', 'split', '|')
383 self.checkequal(['', 'bothcase', ''], '|bothcase|', 'split', '|')
384 self.checkequal(['a', '', 'b\x00c\x00d'], 'a\x00\x00b\x00c\x00d', 'split', '\x00', 2)
386 self.checkequal(['a']*20, ('a|'*20)[:-1], 'split', '|')
387 self.checkequal(['a']*15 +['a|a|a|a|a'],
391 self.checkequal(['a', 'b', 'c', 'd'], 'a//b//c//d', 'split', '//')
392 self.checkequal(['a', 'b//c//d'], 'a//b//c//d', 'split', '//', 1)
393 self.checkequal(['a', 'b', 'c//d'], 'a//b//c//d', 'split', '//', 2)
394 self.checkequal(['a', 'b', 'c', 'd'], 'a//b//c//d', 'split', '//', 3)
395 self.checkequal(['a', 'b', 'c', 'd'], 'a//b//c//d', 'split', '//', 4)
396 self.checkequal(['a', 'b', 'c', 'd'], 'a//b//c//d', 'split', '//',
398 self.checkequal(['a//b//c//d'], 'a//b//c//d', 'split', '//', 0)
399 self.checkequal(['a', '', 'b////c////d'], 'a////b////c////d', 'split', '//', 2)
400 self.checkequal(['endcase ', ''], 'endcase test', 'split', 'test')
401 self.checkequal(['', ' begincase'], 'test begincase', 'split', 'test')
402 self.checkequal(['', ' bothcase ', ''], 'test bothcase test',
404 self.checkequal(['a', 'bc'], 'abbbc', 'split', 'bb')
405 self.checkequal(['', ''], 'aaa', 'split', 'aaa')
406 self.checkequal(['aaa'], 'aaa', 'split', 'aaa', 0)
407 self.checkequal(['ab', 'ab'], 'abbaab', 'split', 'ba')
408 self.checkequal(['aaaa'], 'aaaa', 'split', 'aab')
409 self.checkequal([''], '', 'split', 'aaa')
410 self.checkequal(['aa'], 'aa', 'split', 'aaa')
411 self.checkequal(['A', 'bobb'], 'Abbobbbobb', 'split', 'bbobb')
412 self.checkequal(['A', 'B', ''], 'AbbobbBbbobb', 'split', 'bbobb')
414 self.checkequal(['a']*20, ('aBLAH'*20)[:-4], 'split', 'BLAH')
415 self.checkequal(['a']*20, ('aBLAH'*20)[:-4], 'split', 'BLAH', 19)
416 self.checkequal(['a']*18 + ['aBLAHa'], ('aBLAH'*20)[:-4],
422 self.checkequal(result, 'a b c d', 'split', u' ', 2)
432 self.checkequal(['this', 'is', 'the', 'rsplit', 'function'],
436 self.checkequal(['a', 'b', 'c', 'd'], 'a b c d ', 'rsplit')
437 self.checkequal(['a b c', 'd'], 'a b c d', 'rsplit', None, 1)
438 self.checkequal(['a b', 'c', 'd'], 'a b c d', 'rsplit', None, 2)
439 self.checkequal(['a', 'b', 'c', 'd'], 'a b c d', 'rsplit', None, 3)
440 self.checkequal(['a', 'b', 'c', 'd'], 'a b c d', 'rsplit', None, 4)
441 self.checkequal(['a', 'b', 'c', 'd'], 'a b c d', 'rsplit', None,
443 self.checkequal(['a b c d'], 'a b c d', 'rsplit', None, 0)
444 self.checkequal(['a b c d'], 'a b c d ', 'rsplit', None, 0)
445 self.checkequal(['a b', 'c', 'd'], 'a b c d', 'rsplit', None, 2)
447 self.checkequal([], ' ', 'rsplit')
448 self.checkequal(['a'], ' a ', 'rsplit')
449 self.checkequal(['a', 'b'], ' a b ', 'rsplit')
450 self.checkequal([' a', 'b'], ' a b ', 'rsplit', None, 1)
451 self.checkequal([' a b c'], ' a b c ', 'rsplit',
453 self.checkequal([' a b','c'], ' a b c ', 'rsplit',
455 self.checkequal([' a', 'b', 'c'], ' a b c ', 'rsplit',
457 self.checkequal(['a', 'b', 'c'], ' a b c ', 'rsplit',
459 self.checkequal(['a', 'b'], '\n\ta \t\r b \v ', 'rsplit', None, 88)
461 self.checkequal(['a']*20, aaa, 'rsplit')
462 self.checkequal([aaa[:-4]] + ['a'], aaa, 'rsplit', None, 1)
463 self.checkequal([' a a'] + ['a']*18, aaa, 'rsplit', None, 18)
467 self.checkequal(['arf', 'barf'], b, 'rsplit')
468 self.checkequal(['arf', 'barf'], b, 'rsplit', None)
469 self.checkequal(['arf', 'barf'], b, 'rsplit', None, 2)
472 self.checkequal(['a', 'b', 'c', 'd'], 'a|b|c|d', 'rsplit', '|')
473 self.checkequal(['a|b|c', 'd'], 'a|b|c|d', 'rsplit', '|', 1)
474 self.checkequal(['a|b', 'c', 'd'], 'a|b|c|d', 'rsplit', '|', 2)
475 self.checkequal(['a', 'b', 'c', 'd'], 'a|b|c|d', 'rsplit', '|', 3)
476 self.checkequal(['a', 'b', 'c', 'd'], 'a|b|c|d', 'rsplit', '|', 4)
477 self.checkequal(['a', 'b', 'c', 'd'], 'a|b|c|d', 'rsplit', '|',
479 self.checkequal(['a|b|c|d'], 'a|b|c|d', 'rsplit', '|', 0)
480 self.checkequal(['a||b||c', '', 'd'], 'a||b||c||d', 'rsplit', '|', 2)
481 self.checkequal(['abcd'], 'abcd', 'rsplit', '|')
482 self.checkequal([''], '', 'rsplit', '|')
483 self.checkequal(['', ' begincase'], '| begincase', 'rsplit', '|')
484 self.checkequal(['endcase ', ''], 'endcase |', 'rsplit', '|')
485 self.checkequal(['', 'bothcase', ''], '|bothcase|', 'rsplit', '|')
487 self.checkequal(['a\x00\x00b', 'c', 'd'], 'a\x00\x00b\x00c\x00d', 'rsplit', '\x00', 2)
489 self.checkequal(['a']*20, ('a|'*20)[:-1], 'rsplit', '|')
490 self.checkequal(['a|a|a|a|a']+['a']*15,
494 self.checkequal(['a', 'b', 'c', 'd'], 'a//b//c//d', 'rsplit', '//')
495 self.checkequal(['a//b//c', 'd'], 'a//b//c//d', 'rsplit', '//', 1)
496 self.checkequal(['a//b', 'c', 'd'], 'a//b//c//d', 'rsplit', '//', 2)
497 self.checkequal(['a', 'b', 'c', 'd'], 'a//b//c//d', 'rsplit', '//', 3)
498 self.checkequal(['a', 'b', 'c', 'd'], 'a//b//c//d', 'rsplit', '//', 4)
499 self.checkequal(['a', 'b', 'c', 'd'], 'a//b//c//d', 'rsplit', '//',
501 self.checkequal(['a//b//c//d'], 'a//b//c//d', 'rsplit', '//', 0)
502 self.checkequal(['a////b////c', '', 'd'], 'a////b////c////d', 'rsplit', '//', 2)
503 self.checkequal(['', ' begincase'], 'test begincase', 'rsplit', 'test')
504 self.checkequal(['endcase ', ''], 'endcase test', 'rsplit', 'test')
505 self.checkequal(['', ' bothcase ', ''], 'test bothcase test',
507 self.checkequal(['ab', 'c'], 'abbbc', 'rsplit', 'bb')
508 self.checkequal(['', ''], 'aaa', 'rsplit', 'aaa')
509 self.checkequal(['aaa'], 'aaa', 'rsplit', 'aaa', 0)
510 self.checkequal(['ab', 'ab'], 'abbaab', 'rsplit', 'ba')
511 self.checkequal(['aaaa'], 'aaaa', 'rsplit', 'aab')
512 self.checkequal([''], '', 'rsplit', 'aaa')
513 self.checkequal(['aa'], 'aa', 'rsplit', 'aaa')
514 self.checkequal(['bbob', 'A'], 'bbobbbobbA', 'rsplit', 'bbobb')
515 self.checkequal(['', 'B', 'A'], 'bbobbBbbobbA', 'rsplit', 'bbobb')
517 self.checkequal(['a']*20, ('aBLAH'*20)[:-4], 'rsplit', 'BLAH')
518 self.checkequal(['a']*20, ('aBLAH'*20)[:-4], 'rsplit', 'BLAH', 19)
519 self.checkequal(['aBLAHa'] + ['a']*18, ('aBLAH'*20)[:-4],
525 self.checkequal(result, 'a b c d', 'rsplit', u' ', 2)
535 self.checkequal('hello', ' hello ', 'strip')
536 self.checkequal('hello ', ' hello ', 'lstrip')
537 self.checkequal(' hello', ' hello ', 'rstrip')
538 self.checkequal('hello', 'hello', 'strip')
541 self.checkequal('abc', b, 'strip')
542 self.checkequal('abc \t\n\r\f\v', b, 'lstrip')
543 self.checkequal(' \t\n\r\f\vabc', b, 'rstrip')
546 self.checkequal('hello', ' hello ', 'strip', None)
547 self.checkequal('hello ', ' hello ', 'lstrip', None)
548 self.checkequal(' hello', ' hello ', 'rstrip', None)
549 self.checkequal('hello', 'hello', 'strip', None)
553 self.checkequal('hello', 'xyzzyhelloxyzzy', 'strip', 'xyz')
554 self.checkequal('helloxyzzy', 'xyzzyhelloxyzzy', 'lstrip', 'xyz')
555 self.checkequal('xyzzyhello', 'xyzzyhelloxyzzy', 'rstrip', 'xyz')
556 self.checkequal('hello', 'hello', 'strip', 'xyz')
557 self.checkequal('', 'mississippi', 'strip', 'mississippi')
560 self.checkequal('mississipp', 'mississippi', 'strip', 'i')
564 self.checkequal(unicode('hello', 'ascii'), 'xyzzyhelloxyzzy',
566 self.checkequal(unicode('helloxyzzy', 'ascii'), 'xyzzyhelloxyzzy',
568 self.checkequal(unicode('xyzzyhello', 'ascii'), 'xyzzyhelloxyzzy',
579 self.checkequal('abc ', 'abc', 'ljust', 10)
580 self.checkequal('abc ', 'abc', 'ljust', 6)
581 self.checkequal('abc', 'abc', 'ljust', 3)
582 self.checkequal('abc', 'abc', 'ljust', 2)
587 self.checkequal('abc*******', 'abc', 'ljust', 10, '*')
591 self.checkequal(' abc', 'abc', 'rjust', 10)
592 self.checkequal(' abc', 'abc', 'rjust', 6)
593 self.checkequal('abc', 'abc', 'rjust', 3)
594 self.checkequal('abc', 'abc', 'rjust', 2)
599 self.checkequal('*******abc', 'abc', 'rjust', 10, '*')
603 self.checkequal(' abc ', 'abc', 'center', 10)
604 self.checkequal(' abc ', 'abc', 'center', 6)
605 self.checkequal('abc', 'abc', 'center', 3)
606 self.checkequal('abc', 'abc', 'center', 2)
612 self.checkequal('***abc****', 'abc', 'center', 10, '*')
616 self.checkequal('hEllO CoMPuTErS', 'HeLLo cOmpUteRs', 'swapcase')
621 EQ = self.checkequal
774 self.checkequal('one@two!three!', 'one!two!three!', 'replace', '!', '@', 1)
775 self.checkequal('onetwothree', 'one!two!three!', 'replace', '!', '')
776 self.checkequal('one@two@three!', 'one!two!three!', 'replace', '!', '@', 2)
777 self.checkequal('one@two@three@', 'one!two!three!', 'replace', '!', '@', 3)
778 self.checkequal('one@two@three@', 'one!two!three!', 'replace', '!', '@', 4)
779 self.checkequal('one!two!three!', 'one!two!three!', 'replace', '!', '@', 0)
780 self.checkequal('one@two@three@', 'one!two!three!', 'replace', '!', '@')
781 self.checkequal('one!two!three!', 'one!two!three!', 'replace', 'x', '@')
782 self.checkequal('one!two!three!', 'one!two!three!', 'replace', 'x', '@', 2)
783 self.checkequal('-a-b-c-', 'abc', 'replace', '', '-')
784 self.checkequal('-a-b-c', 'abc', 'replace', '', '-', 3)
785 self.checkequal('abc', 'abc', 'replace', '', '-', 0)
786 self.checkequal('', '', 'replace', '', '')
787 self.checkequal('abc', 'abc', 'replace', 'ab', '--', 0)
788 self.checkequal('abc', 'abc', 'replace', 'xy', '--')
792 self.checkequal('', '123', 'replace', '123', '')
793 self.checkequal('', '123123', 'replace', '123', '')
794 self.checkequal('x', '123x123', 'replace', '123', '')
811 self.checkequal('123', '123', 'zfill', 2)
812 self.checkequal('123', '123', 'zfill', 3)
813 self.checkequal('0123', '123', 'zfill', 4)
814 self.checkequal('+123', '+123', 'zfill', 3)
815 self.checkequal('+123', '+123', 'zfill', 4)
816 self.checkequal('+0123', '+123', 'zfill', 5)
817 self.checkequal('-123', '-123', 'zfill', 3)
818 self.checkequal('-123', '-123', 'zfill', 4)
819 self.checkequal('-0123', '-123', 'zfill', 5)
820 self.checkequal('000', '', 'zfill', 3)
821 self.checkequal('34', '34', 'zfill', 1)
822 self.checkequal('0034', '34', 'zfill', 4)
832 self.checkequal(False, '', 'islower')
833 self.checkequal(True, 'a', 'islower')
834 self.checkequal(False, 'A', 'islower')
835 self.checkequal(False, '\n', 'islower')
836 self.checkequal(True, 'abc', 'islower')
837 self.checkequal(False, 'aBc', 'islower')
838 self.checkequal(True, 'abc\n', 'islower')
842 self.checkequal(False, '', 'isupper')
843 self.checkequal(False, 'a', 'isupper')
844 self.checkequal(True, 'A', 'isupper')
845 self.checkequal(False, '\n', 'isupper')
846 self.checkequal(True, 'ABC', 'isupper')
847 self.checkequal(False, 'AbC', 'isupper')
848 self.checkequal(True, 'ABC\n', 'isupper')
852 self.checkequal(False, '', 'istitle')
853 self.checkequal(False, 'a', 'istitle')
854 self.checkequal(True, 'A', 'istitle')
855 self.checkequal(False, '\n', 'istitle')
856 self.checkequal(True, 'A Titlecased Line', 'istitle')
857 self.checkequal(True, 'A\nTitlecased Line', 'istitle')
858 self.checkequal(True, 'A Titlecased, Line', 'istitle')
859 self.checkequal(False, 'Not a capitalized String', 'istitle')
860 self.checkequal(False, 'Not\ta Titlecase String', 'istitle')
861 self.checkequal(False, 'Not--a Titlecase String', 'istitle')
862 self.checkequal(False, 'NOT', 'istitle')
866 self.checkequal(False, '', 'isspace')
867 self.checkequal(False, 'a', 'isspace')
868 self.checkequal(True, ' ', 'isspace')
869 self.checkequal(True, '\t', 'isspace')
870 self.checkequal(True, '\r', 'isspace')
871 self.checkequal(True, '\n', 'isspace')
872 self.checkequal(True, ' \t\r\n', 'isspace')
873 self.checkequal(False, ' \t\r\na', 'isspace')
877 self.checkequal(False, '', 'isalpha')
878 self.checkequal(True, 'a', 'isalpha')
879 self.checkequal(True, 'A', 'isalpha')
880 self.checkequal(False, '\n', 'isalpha')
881 self.checkequal(True, 'abc', 'isalpha')
882 self.checkequal(False, 'aBc123', 'isalpha')
883 self.checkequal(False, 'abc\n', 'isalpha')
887 self.checkequal(False, '', 'isalnum')
888 self.checkequal(True, 'a', 'isalnum')
889 self.checkequal(True, 'A', 'isalnum')
890 self.checkequal(False, '\n', 'isalnum')
891 self.checkequal(True, '123abc456', 'isalnum')
892 self.checkequal(True, 'a1b3c', 'isalnum')
893 self.checkequal(False, 'aBc000 ', 'isalnum')
894 self.checkequal(False, 'abc\n', 'isalnum')
898 self.checkequal(False, '', 'isdigit')
899 self.checkequal(False, 'a', 'isdigit')
900 self.checkequal(True, '0', 'isdigit')
901 self.checkequal(True, '0123456789', 'isdigit')
902 self.checkequal(False, '0123456789a', 'isdigit')
907 self.checkequal(' Hello ', ' hello ', 'title')
908 self.checkequal('Hello ', 'hello ', 'title')
909 self.checkequal('Hello ', 'Hello ', 'title')
910 self.checkequal('Format This As Title String', "fOrMaT thIs aS titLe String", 'title')
911 self.checkequal('Format,This-As*Title;String', "fOrMaT,thIs-aS*titLe;String", 'title', )
912 self.checkequal('Getint', "getInt", 'title')
916 self.checkequal(['abc', 'def', '', 'ghi'], "abc\ndef\n\rghi", 'splitlines')
917 self.checkequal(['abc', 'def', '', 'ghi'], "abc\ndef\n\r\nghi", 'splitlines')
918 self.checkequal(['abc', 'def', 'ghi'], "abc\ndef\r\nghi", 'splitlines')
919 self.checkequal(['abc', 'def', 'ghi'], "abc\ndef\r\nghi\n", 'splitlines')
920 self.checkequal(['abc', 'def', 'ghi', ''], "abc\ndef\r\nghi\n\r", 'splitlines')
921 self.checkequal(['', 'abc', 'def', 'ghi', ''], "\nabc\ndef\r\nghi\n\r", 'splitlines')
922 …self.checkequal(['\n', 'abc\n', 'def\r\n', 'ghi\n', '\r'], "\nabc\ndef\r\nghi\n\r", 'splitlines', …
933 self.checkequal(True, 'hello', 'startswith', 'he')
934 self.checkequal(True, 'hello', 'startswith', 'hello')
935 self.checkequal(False, 'hello', 'startswith', 'hello world')
936 self.checkequal(True, 'hello', 'startswith', '')
937 self.checkequal(False, 'hello', 'startswith', 'ello')
938 self.checkequal(True, 'hello', 'startswith', 'ello', 1)
939 self.checkequal(True, 'hello', 'startswith', 'o', 4)
940 self.checkequal(False, 'hello', 'startswith', 'o', 5)
941 self.checkequal(True, 'hello', 'startswith', '', 5)
942 self.checkequal(False, 'hello', 'startswith', 'lo', 6)
943 self.checkequal(True, 'helloworld', 'startswith', 'lowo', 3)
944 self.checkequal(True, 'helloworld', 'startswith', 'lowo', 3, 7)
945 self.checkequal(False, 'helloworld', 'startswith', 'lowo', 3, 6)
948 self.checkequal(True, 'hello', 'startswith', 'he', 0, -1)
949 self.checkequal(True, 'hello', 'startswith', 'he', -53, -1)
950 self.checkequal(False, 'hello', 'startswith', 'hello', 0, -1)
951 self.checkequal(False, 'hello', 'startswith', 'hello world', -1, -10)
952 self.checkequal(False, 'hello', 'startswith', 'ello', -5)
953 self.checkequal(True, 'hello', 'startswith', 'ello', -4)
954 self.checkequal(False, 'hello', 'startswith', 'o', -2)
955 self.checkequal(True, 'hello', 'startswith', 'o', -1)
956 self.checkequal(True, 'hello', 'startswith', '', -3, -3)
957 self.checkequal(False, 'hello', 'startswith', 'lo', -9)
963 self.checkequal(True, 'hello', 'startswith', ('he', 'ha'))
964 self.checkequal(False, 'hello', 'startswith', ('lo', 'llo'))
965 self.checkequal(True, 'hello', 'startswith', ('hellox', 'hello'))
966 self.checkequal(False, 'hello', 'startswith', ())
967 self.checkequal(True, 'helloworld', 'startswith', ('hellowo',
969 self.checkequal(False, 'helloworld', 'startswith', ('hellowo', 'ello',
971 self.checkequal(True, 'hello', 'startswith', ('lo', 'he'), 0, -1)
972 self.checkequal(False, 'hello', 'startswith', ('he', 'hel'), 0, 1)
973 self.checkequal(True, 'hello', 'startswith', ('he', 'hel'), 0, 2)
978 self.checkequal(True, 'hello', 'endswith', 'lo')
979 self.checkequal(False, 'hello', 'endswith', 'he')
980 self.checkequal(True, 'hello', 'endswith', '')
981 self.checkequal(False, 'hello', 'endswith', 'hello world')
982 self.checkequal(False, 'helloworld', 'endswith', 'worl')
983 self.checkequal(True, 'helloworld', 'endswith', 'worl', 3, 9)
984 self.checkequal(True, 'helloworld', 'endswith', 'world', 3, 12)
985 self.checkequal(True, 'helloworld', 'endswith', 'lowo', 1, 7)
986 self.checkequal(True, 'helloworld', 'endswith', 'lowo', 2, 7)
987 self.checkequal(True, 'helloworld', 'endswith', 'lowo', 3, 7)
988 self.checkequal(False, 'helloworld', 'endswith', 'lowo', 4, 7)
989 self.checkequal(False, 'helloworld', 'endswith', 'lowo', 3, 8)
990 self.checkequal(False, 'ab', 'endswith', 'ab', 0, 1)
991 self.checkequal(False, 'ab', 'endswith', 'ab', 0, 0)
994 self.checkequal(True, 'hello', 'endswith', 'lo', -2)
995 self.checkequal(False, 'hello', 'endswith', 'he', -2)
996 self.checkequal(True, 'hello', 'endswith', '', -3, -3)
997 self.checkequal(False, 'hello', 'endswith', 'hello world', -10, -2)
998 self.checkequal(False, 'helloworld', 'endswith', 'worl', -6)
999 self.checkequal(True, 'helloworld', 'endswith', 'worl', -5, -1)
1000 self.checkequal(True, 'helloworld', 'endswith', 'worl', -5, 9)
1001 self.checkequal(True, 'helloworld', 'endswith', 'world', -7, 12)
1002 self.checkequal(True, 'helloworld', 'endswith', 'lowo', -99, -3)
1003 self.checkequal(True, 'helloworld', 'endswith', 'lowo', -8, -3)
1004 self.checkequal(True, 'helloworld', 'endswith', 'lowo', -7, -3)
1005 self.checkequal(False, 'helloworld', 'endswith', 'lowo', 3, -4)
1006 self.checkequal(False, 'helloworld', 'endswith', 'lowo', -8, -2)
1012 self.checkequal(False, 'hello', 'endswith', ('he', 'ha'))
1013 self.checkequal(True, 'hello', 'endswith', ('lo', 'llo'))
1014 self.checkequal(True, 'hello', 'endswith', ('hellox', 'hello'))
1015 self.checkequal(False, 'hello', 'endswith', ())
1016 self.checkequal(True, 'helloworld', 'endswith', ('hellowo',
1018 self.checkequal(False, 'helloworld', 'endswith', ('hellowo', 'ello',
1020 self.checkequal(True, 'hello', 'endswith', ('hell', 'ell'), 0, -1)
1021 self.checkequal(False, 'hello', 'endswith', ('he', 'hel'), 0, 1)
1022 self.checkequal(True, 'hello', 'endswith', ('he', 'hell'), 0, 4)
1027 self.checkequal(True, '', '__contains__', '')
1028 self.checkequal(True, 'abc', '__contains__', '')
1029 self.checkequal(False, 'abc', '__contains__', '\0')
1030 self.checkequal(True, '\0abc', '__contains__', '\0')
1031 self.checkequal(True, 'abc\0', '__contains__', '\0')
1032 self.checkequal(True, '\0abc', '__contains__', 'a')
1033 self.checkequal(True, 'asdf', '__contains__', 'asdf')
1034 self.checkequal(False, 'asd', '__contains__', 'asdf')
1035 self.checkequal(False, '', '__contains__', 'asdf')
1038 self.checkequal(u'a', 'abc', '__getitem__', 0)
1039 self.checkequal(u'c', 'abc', '__getitem__', -1)
1040 self.checkequal(u'a', 'abc', '__getitem__', 0L)
1041 self.checkequal(u'abc', 'abc', '__getitem__', slice(0, 3))
1042 self.checkequal(u'abc', 'abc', '__getitem__', slice(0, 1000))
1043 self.checkequal(u'a', 'abc', '__getitem__', slice(0, 1))
1044 self.checkequal(u'', 'abc', '__getitem__', slice(0, 0))
1049 self.checkequal('abc', 'abc', '__getslice__', 0, 1000)
1050 self.checkequal('abc', 'abc', '__getslice__', 0, 3)
1051 self.checkequal('ab', 'abc', '__getslice__', 0, 2)
1052 self.checkequal('bc', 'abc', '__getslice__', 1, 3)
1053 self.checkequal('b', 'abc', '__getslice__', 1, 2)
1054 self.checkequal('', 'abc', '__getslice__', 2, 2)
1055 self.checkequal('', 'abc', '__getslice__', 1000, 1000)
1056 self.checkequal('', 'abc', '__getslice__', 2000, 1000)
1057 self.checkequal('', 'abc', '__getslice__', 2, 1)
1070 self.checkequal(u"".join(L), s, '__getitem__',
1074 self.checkequal('', 'abc', '__mul__', -1)
1075 self.checkequal('', 'abc', '__mul__', 0)
1076 self.checkequal('abc', 'abc', '__mul__', 1)
1077 self.checkequal('abcabcabc', 'abc', '__mul__', 3)
1089 self.checkequal('a b c d', ' ', 'join', ['a', 'b', 'c', 'd'])
1090 self.checkequal('abcd', '', 'join', ('a', 'b', 'c', 'd'))
1091 self.checkequal('bd', '', 'join', ('', 'b', '', 'd'))
1092 self.checkequal('ac', '', 'join', ('a', '', 'c', ''))
1093 self.checkequal('w x y z', ' ', 'join', Sequence())
1094 self.checkequal('abc', 'a', 'join', ('abc',))
1095 self.checkequal('z', 'a', 'join', UserList(['z']))
1097 self.checkequal(unicode('a.b.c'), unicode('.'), 'join', ['a', 'b', 'c'])
1098 self.checkequal(unicode('a.b.c'), '.', 'join', [unicode('a'), 'b', 'c'])
1099 self.checkequal(unicode('a.b.c'), '.', 'join', ['a', unicode('b'), 'c'])
1100 self.checkequal(unicode('a.b.c'), '.', 'join', ['a', 'b', unicode('c')])
1103 self.checkequal(((('a' * i) + '-') * i)[:-1], '-', 'join',
1105 self.checkequal(((('a' * i) + '-') * i)[:-1], '-', 'join',
1109 self.checkequal('a b c', ' ', 'join', BadSeq2())
1126 self.checkequal('+hello+', '+%s+', '__mod__', 'hello')
1127 self.checkequal('+10+', '+%d+', '__mod__', 10)
1128 self.checkequal('a', "%c", '__mod__', "a")
1129 self.checkequal('a', "%c", '__mod__', "a")
1130 self.checkequal('"', "%c", '__mod__', 34)
1131 self.checkequal('$', "%c", '__mod__', 36)
1132 self.checkequal('10', "%d", '__mod__', 10)
1133 self.checkequal('\x7f', "%c", '__mod__', 0x7f)
1142 self.checkequal(' 42', '%3ld', '__mod__', 42)
1143 self.checkequal('42', '%d', '__mod__', 42L)
1144 self.checkequal('42', '%d', '__mod__', 42.0)
1145 self.checkequal(slongvalue, '%d', '__mod__', longvalue)
1147 self.checkequal('0042.00', '%07.2f', '__mod__', 42)
1148 self.checkequal('0042.00', '%07.2F', '__mod__', 42)
1160 self.checkequal('bar', '%((foo))s', '__mod__', {'(foo)': 'bar'})
1163 self.checkequal(103*'a'+'x', '%sx', '__mod__', 103*'a')
1174 self.checkequal('melon apple', '%(melon)s %(apple)s', '__mod__', X())
1205 self.checkequal('a', 'A', 'lower')
1206 self.checkequal(True, 'A', 'isupper')
1207 self.checkequal('A', 'a', 'upper')
1208 self.checkequal(True, 'a', 'islower')
1210 self.checkequal('a', 'A', 'replace', 'A', 'a')
1211 self.checkequal(True, 'A', 'isupper')
1213 self.checkequal('A', 'a', 'capitalize')
1214 self.checkequal(True, 'a', 'islower')
1216 self.checkequal('A', 'a', 'swapcase')
1217 self.checkequal(True, 'a', 'islower')
1219 self.checkequal('A', 'a', 'title')
1220 self.checkequal(True, 'a', 'islower')
1224 self.checkequal(('this is the par', 'ti', 'tion method'),
1229 self.checkequal(('http', '://', 'www.python.org'), S, 'partition', '://')
1230 self.checkequal(('http://www.python.org', '', ''), S, 'partition', '?')
1231 self.checkequal(('', 'http://', 'www.python.org'), S, 'partition', 'http://')
1232 self.checkequal(('http://www.python.', 'org', ''), S, 'partition', 'org')
1242 self.checkequal(('this is the rparti', 'ti', 'on method'),
1247 self.checkequal(('http', '://', 'www.python.org'), S, 'rpartition', '://')
1248 self.checkequal(('', '', 'http://www.python.org'), S, 'rpartition', '?')
1249 self.checkequal(('', 'http://', 'www.python.org'), S, 'rpartition', 'http://')
1250 self.checkequal(('http://www.python.', 'org', ''), S, 'rpartition', 'org')
1261 self.checkequal(2, s, 'find', 'l', None)
1262 self.checkequal(3, s, 'find', 'l', -2, None)
1263 self.checkequal(2, s, 'find', 'l', None, -2)
1264 self.checkequal(0, s, 'find', 'h', None, None)
1266 self.checkequal(3, s, 'rfind', 'l', None)
1267 self.checkequal(3, s, 'rfind', 'l', -2, None)
1268 self.checkequal(2, s, 'rfind', 'l', None, -2)
1269 self.checkequal(0, s, 'rfind', 'h', None, None)
1271 self.checkequal(2, s, 'index', 'l', None)
1272 self.checkequal(3, s, 'index', 'l', -2, None)
1273 self.checkequal(2, s, 'index', 'l', None, -2)
1274 self.checkequal(0, s, 'index', 'h', None, None)
1276 self.checkequal(3, s, 'rindex', 'l', None)
1277 self.checkequal(3, s, 'rindex', 'l', -2, None)
1278 self.checkequal(2, s, 'rindex', 'l', None, -2)
1279 self.checkequal(0, s, 'rindex', 'h', None, None)
1281 self.checkequal(2, s, 'count', 'l', None)
1282 self.checkequal(1, s, 'count', 'l', -2, None)
1283 self.checkequal(1, s, 'count', 'l', None, -2)
1284 self.checkequal(0, s, 'count', 'x', None, None)
1286 self.checkequal(True, s, 'endswith', 'o', None)
1287 self.checkequal(True, s, 'endswith', 'lo', -2, None)
1288 self.checkequal(True, s, 'endswith', 'l', None, -2)
1289 self.checkequal(False, s, 'endswith', 'x', None, None)
1291 self.checkequal(True, s, 'startswith', 'h', None)
1292 self.checkequal(True, s, 'startswith', 'l', -2, None)
1293 self.checkequal(True, s, 'startswith', 'h', None, -2)
1294 self.checkequal(False, s, 'startswith', 'x', None, None)
1328 self.checkequal('xyzxyz', 'xyzabcdef', 'translate', table, 'def')
1331 self.checkequal('Abc', 'abc', 'translate', table)
1332 self.checkequal('xyz', 'xyz', 'translate', table)
1333 self.checkequal('yz', 'xyz', 'translate', table, 'x')
1334 self.checkequal('yx', 'zyzzx', 'translate', None, 'z')
1335 self.checkequal('zyzzx', 'zyzzx', 'translate', None, '')
1336 self.checkequal('zyzzx', 'zyzzx', 'translate', None)
1353 self.checkequal(data, 'hello world', 'encode', encoding)
1355 self.checkequal('hello world', data, 'decode', encoding)
1364 self.checkequal(data, 'hello world', 'encode', 'zlib')
1366 self.checkequal('hello world', data, 'decode', 'zlib')