Lines Matching refs:checkequal

58     def checkequal(self, result, obj, methodname, *args, **kwargs):  member in BaseTest
96 self.checkequal(3, 'aaa', 'count', 'a')
97 self.checkequal(0, 'aaa', 'count', 'b')
98 self.checkequal(3, 'aaa', 'count', 'a')
99 self.checkequal(0, 'aaa', 'count', 'b')
100 self.checkequal(3, 'aaa', 'count', 'a')
101 self.checkequal(0, 'aaa', 'count', 'b')
102 self.checkequal(0, 'aaa', 'count', 'b')
103 self.checkequal(2, 'aaa', 'count', 'a', 1)
104 self.checkequal(0, 'aaa', 'count', 'a', 10)
105 self.checkequal(1, 'aaa', 'count', 'a', -1)
106 self.checkequal(3, 'aaa', 'count', 'a', -10)
107 self.checkequal(1, 'aaa', 'count', 'a', 0, 1)
108 self.checkequal(3, 'aaa', 'count', 'a', 0, 10)
109 self.checkequal(2, 'aaa', 'count', 'a', 0, -1)
110 self.checkequal(0, 'aaa', 'count', 'a', 0, -10)
111 self.checkequal(3, 'aaa', 'count', '', 1)
112 self.checkequal(1, 'aaa', 'count', '', 3)
113 self.checkequal(0, 'aaa', 'count', '', 10)
114 self.checkequal(2, 'aaa', 'count', '', -1)
115 self.checkequal(4, 'aaa', 'count', '', -10)
117 self.checkequal(1, '', 'count', '')
118 self.checkequal(0, '', 'count', '', 1, 1)
119 self.checkequal(0, '', 'count', '', sys.maxsize, 0)
121 self.checkequal(0, '', 'count', 'xx')
122 self.checkequal(0, '', 'count', 'xx', 1, 1)
123 self.checkequal(0, '', 'count', 'xx', sys.maxsize, 0)
128 self.checkequal(0, 'hello', 'count', 42)
160 self.checkequal(0, 'abcdefghiabc', 'find', 'abc')
161 self.checkequal(9, 'abcdefghiabc', 'find', 'abc', 1)
162 self.checkequal(-1, 'abcdefghiabc', 'find', 'def', 4)
164 self.checkequal(0, 'abc', 'find', '', 0)
165 self.checkequal(3, 'abc', 'find', '', 3)
166 self.checkequal(-1, 'abc', 'find', '', 4)
169 self.checkequal( 2, 'rrarrrrrrrrra', 'find', 'a')
170 self.checkequal(12, 'rrarrrrrrrrra', 'find', 'a', 4)
171 self.checkequal(-1, 'rrarrrrrrrrra', 'find', 'a', 4, 6)
172 self.checkequal(12, 'rrarrrrrrrrra', 'find', 'a', 4, None)
173 self.checkequal( 2, 'rrarrrrrrrrra', 'find', 'a', None, 6)
178 self.checkequal(-1, 'hello', 'find', 42)
182 self.checkequal(0, '', 'find', '')
183 self.checkequal(-1, '', 'find', '', 1, 1)
184 self.checkequal(-1, '', 'find', '', sys.maxsize, 0)
186 self.checkequal(-1, '', 'find', 'xx')
187 self.checkequal(-1, '', 'find', 'xx', 1, 1)
188 self.checkequal(-1, '', 'find', 'xx', sys.maxsize, 0)
191 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)
236 self.checkequal(-1, 'hello', 'rfind', 42)
264 self.checkequal(-1, 'ab', 'rfind', 'xxx', sys.maxsize + 1, 0)
267 self.checkequal(0, '<......\u043c...', "rfind", "<")
270 self.checkequal(0, 'abcdefghiabc', 'index', '')
271 self.checkequal(3, 'abcdefghiabc', 'index', 'def')
272 self.checkequal(0, 'abcdefghiabc', 'index', 'abc')
273 self.checkequal(9, 'abcdefghiabc', 'index', 'abc', 1)
281 self.checkequal( 2, 'rrarrrrrrrrra', 'index', 'a')
282 self.checkequal(12, 'rrarrrrrrrrra', 'index', 'a', 4)
284 self.checkequal(12, 'rrarrrrrrrrra', 'index', 'a', 4, None)
285 self.checkequal( 2, 'rrarrrrrrrrra', 'index', 'a', None, 6)
295 self.checkequal(12, 'abcdefghiabc', 'rindex', '')
296 self.checkequal(3, 'abcdefghiabc', 'rindex', 'def')
297 self.checkequal(9, 'abcdefghiabc', 'rindex', 'abc')
298 self.checkequal(0, 'abcdefghiabc', 'rindex', 'abc', 0, -1)
307 self.checkequal(12, 'rrarrrrrrrrra', 'rindex', 'a')
308 self.checkequal(12, 'rrarrrrrrrrra', 'rindex', 'a', 4)
310 self.checkequal(12, 'rrarrrrrrrrra', 'rindex', 'a', 4, None)
311 self.checkequal( 2, 'rrarrrrrrrrra', 'rindex', 'a', None, 6)
321 self.checkequal('hello', 'HeLLo', 'lower')
322 self.checkequal('hello', 'hello', 'lower')
326 self.checkequal('HELLO', 'HeLLo', 'upper')
327 self.checkequal('HELLO', 'HELLO', 'upper')
331 self.checkequal('abc\rab def\ng hi', 'abc\rab\tdef\ng\thi',
333 self.checkequal('abc\rab def\ng hi', 'abc\rab\tdef\ng\thi',
335 self.checkequal('abc\rab def\ng hi', 'abc\rab\tdef\ng\thi',
337 self.checkequal('abc\r\nab def\ng hi', 'abc\r\nab\tdef\ng\thi',
339 self.checkequal('abc\r\nab def\ng hi', 'abc\r\nab\tdef\ng\thi',
341 self.checkequal('abc\r\nab def\ng hi', 'abc\r\nab\tdef\ng\thi',
343 self.checkequal('abc\r\nab\r\ndef\ng\r\nhi', 'abc\r\nab\r\ndef\ng\r\nhi',
346 self.checkequal('abc\rab def\ng hi', 'abc\rab\tdef\ng\thi',
348 self.checkequal('abc\rab def\ng hi', 'abc\rab\tdef\ng\thi',
351 self.checkequal(' a\n b', ' \ta\n\tb', 'expandtabs', 1)
361 self.checkequal(['a', 'b', 'c', 'd'], 'a|b|c|d', 'split', '|')
362 self.checkequal(['a|b|c|d'], 'a|b|c|d', 'split', '|', 0)
363 self.checkequal(['a', 'b|c|d'], 'a|b|c|d', 'split', '|', 1)
364 self.checkequal(['a', 'b', 'c|d'], 'a|b|c|d', 'split', '|', 2)
365 self.checkequal(['a', 'b', 'c', 'd'], 'a|b|c|d', 'split', '|', 3)
366 self.checkequal(['a', 'b', 'c', 'd'], 'a|b|c|d', 'split', '|', 4)
367 self.checkequal(['a', 'b', 'c', 'd'], 'a|b|c|d', 'split', '|',
369 self.checkequal(['a|b|c|d'], 'a|b|c|d', 'split', '|', 0)
370 self.checkequal(['a', '', 'b||c||d'], 'a||b||c||d', 'split', '|', 2)
371 self.checkequal(['abcd'], 'abcd', 'split', '|')
372 self.checkequal([''], '', 'split', '|')
373 self.checkequal(['endcase ', ''], 'endcase |', 'split', '|')
374 self.checkequal(['', ' startcase'], '| startcase', 'split', '|')
375 self.checkequal(['', 'bothcase', ''], '|bothcase|', 'split', '|')
376 self.checkequal(['a', '', 'b\x00c\x00d'], 'a\x00\x00b\x00c\x00d', 'split', '\x00', 2)
378 self.checkequal(['a']*20, ('a|'*20)[:-1], 'split', '|')
379 self.checkequal(['a']*15 +['a|a|a|a|a'],
383 self.checkequal(['a', 'b', 'c', 'd'], 'a//b//c//d', 'split', '//')
384 self.checkequal(['a', 'b//c//d'], 'a//b//c//d', 'split', '//', 1)
385 self.checkequal(['a', 'b', 'c//d'], 'a//b//c//d', 'split', '//', 2)
386 self.checkequal(['a', 'b', 'c', 'd'], 'a//b//c//d', 'split', '//', 3)
387 self.checkequal(['a', 'b', 'c', 'd'], 'a//b//c//d', 'split', '//', 4)
388 self.checkequal(['a', 'b', 'c', 'd'], 'a//b//c//d', 'split', '//',
390 self.checkequal(['a//b//c//d'], 'a//b//c//d', 'split', '//', 0)
391 self.checkequal(['a', '', 'b////c////d'], 'a////b////c////d', 'split', '//', 2)
392 self.checkequal(['endcase ', ''], 'endcase test', 'split', 'test')
393 self.checkequal(['', ' begincase'], 'test begincase', 'split', 'test')
394 self.checkequal(['', ' bothcase ', ''], 'test bothcase test',
396 self.checkequal(['a', 'bc'], 'abbbc', 'split', 'bb')
397 self.checkequal(['', ''], 'aaa', 'split', 'aaa')
398 self.checkequal(['aaa'], 'aaa', 'split', 'aaa', 0)
399 self.checkequal(['ab', 'ab'], 'abbaab', 'split', 'ba')
400 self.checkequal(['aaaa'], 'aaaa', 'split', 'aab')
401 self.checkequal([''], '', 'split', 'aaa')
402 self.checkequal(['aa'], 'aa', 'split', 'aaa')
403 self.checkequal(['A', 'bobb'], 'Abbobbbobb', 'split', 'bbobb')
404 self.checkequal(['A', 'B', ''], 'AbbobbBbbobb', 'split', 'bbobb')
406 self.checkequal(['a']*20, ('aBLAH'*20)[:-4], 'split', 'BLAH')
407 self.checkequal(['a']*20, ('aBLAH'*20)[:-4], 'split', 'BLAH', 19)
408 self.checkequal(['a']*18 + ['aBLAHa'], ('aBLAH'*20)[:-4],
412 self.checkequal(['a', 'b', 'c', 'd'], 'a|b|c|d', 'split', sep='|')
413 self.checkequal(['a', 'b|c|d'],
415 self.checkequal(['a', 'b|c|d'],
417 self.checkequal(['a', 'b|c|d'],
419 self.checkequal(['a', 'b c d'],
431 self.checkequal(['a', 'b', 'c', 'd'], 'a|b|c|d', 'rsplit', '|')
432 self.checkequal(['a|b|c', 'd'], 'a|b|c|d', 'rsplit', '|', 1)
433 self.checkequal(['a|b', 'c', 'd'], 'a|b|c|d', 'rsplit', '|', 2)
434 self.checkequal(['a', 'b', 'c', 'd'], 'a|b|c|d', 'rsplit', '|', 3)
435 self.checkequal(['a', 'b', 'c', 'd'], 'a|b|c|d', 'rsplit', '|', 4)
436 self.checkequal(['a', 'b', 'c', 'd'], 'a|b|c|d', 'rsplit', '|',
438 self.checkequal(['a|b|c|d'], 'a|b|c|d', 'rsplit', '|', 0)
439 self.checkequal(['a||b||c', '', 'd'], 'a||b||c||d', 'rsplit', '|', 2)
440 self.checkequal(['abcd'], 'abcd', 'rsplit', '|')
441 self.checkequal([''], '', 'rsplit', '|')
442 self.checkequal(['', ' begincase'], '| begincase', 'rsplit', '|')
443 self.checkequal(['endcase ', ''], 'endcase |', 'rsplit', '|')
444 self.checkequal(['', 'bothcase', ''], '|bothcase|', 'rsplit', '|')
446 self.checkequal(['a\x00\x00b', 'c', 'd'], 'a\x00\x00b\x00c\x00d', 'rsplit', '\x00', 2)
448 self.checkequal(['a']*20, ('a|'*20)[:-1], 'rsplit', '|')
449 self.checkequal(['a|a|a|a|a']+['a']*15,
453 self.checkequal(['a', 'b', 'c', 'd'], 'a//b//c//d', 'rsplit', '//')
454 self.checkequal(['a//b//c', 'd'], 'a//b//c//d', 'rsplit', '//', 1)
455 self.checkequal(['a//b', 'c', 'd'], 'a//b//c//d', 'rsplit', '//', 2)
456 self.checkequal(['a', 'b', 'c', 'd'], 'a//b//c//d', 'rsplit', '//', 3)
457 self.checkequal(['a', 'b', 'c', 'd'], 'a//b//c//d', 'rsplit', '//', 4)
458 self.checkequal(['a', 'b', 'c', 'd'], 'a//b//c//d', 'rsplit', '//',
460 self.checkequal(['a//b//c//d'], 'a//b//c//d', 'rsplit', '//', 0)
461 self.checkequal(['a////b////c', '', 'd'], 'a////b////c////d', 'rsplit', '//', 2)
462 self.checkequal(['', ' begincase'], 'test begincase', 'rsplit', 'test')
463 self.checkequal(['endcase ', ''], 'endcase test', 'rsplit', 'test')
464 self.checkequal(['', ' bothcase ', ''], 'test bothcase test',
466 self.checkequal(['ab', 'c'], 'abbbc', 'rsplit', 'bb')
467 self.checkequal(['', ''], 'aaa', 'rsplit', 'aaa')
468 self.checkequal(['aaa'], 'aaa', 'rsplit', 'aaa', 0)
469 self.checkequal(['ab', 'ab'], 'abbaab', 'rsplit', 'ba')
470 self.checkequal(['aaaa'], 'aaaa', 'rsplit', 'aab')
471 self.checkequal([''], '', 'rsplit', 'aaa')
472 self.checkequal(['aa'], 'aa', 'rsplit', 'aaa')
473 self.checkequal(['bbob', 'A'], 'bbobbbobbA', 'rsplit', 'bbobb')
474 self.checkequal(['', 'B', 'A'], 'bbobbBbbobbA', 'rsplit', 'bbobb')
476 self.checkequal(['a']*20, ('aBLAH'*20)[:-4], 'rsplit', 'BLAH')
477 self.checkequal(['a']*20, ('aBLAH'*20)[:-4], 'rsplit', 'BLAH', 19)
478 self.checkequal(['aBLAHa'] + ['a']*18, ('aBLAH'*20)[:-4],
482 self.checkequal(['a', 'b', 'c', 'd'], 'a|b|c|d', 'rsplit', sep='|')
483 self.checkequal(['a|b|c', 'd'],
485 self.checkequal(['a|b|c', 'd'],
487 self.checkequal(['a|b|c', 'd'],
489 self.checkequal(['a b c', 'd'],
500 EQ = self.checkequal
648 self.checkequal('one@two!three!', 'one!two!three!', 'replace', '!', '@', 1)
649 self.checkequal('onetwothree', 'one!two!three!', 'replace', '!', '')
650 self.checkequal('one@two@three!', 'one!two!three!', 'replace', '!', '@', 2)
651 self.checkequal('one@two@three@', 'one!two!three!', 'replace', '!', '@', 3)
652 self.checkequal('one@two@three@', 'one!two!three!', 'replace', '!', '@', 4)
653 self.checkequal('one!two!three!', 'one!two!three!', 'replace', '!', '@', 0)
654 self.checkequal('one@two@three@', 'one!two!three!', 'replace', '!', '@')
655 self.checkequal('one!two!three!', 'one!two!three!', 'replace', 'x', '@')
656 self.checkequal('one!two!three!', 'one!two!three!', 'replace', 'x', '@', 2)
657 self.checkequal('-a-b-c-', 'abc', 'replace', '', '-')
658 self.checkequal('-a-b-c', 'abc', 'replace', '', '-', 3)
659 self.checkequal('abc', 'abc', 'replace', '', '-', 0)
660 self.checkequal('', '', 'replace', '', '')
661 self.checkequal('abc', 'abc', 'replace', 'ab', '--', 0)
662 self.checkequal('abc', 'abc', 'replace', 'xy', '--')
666 self.checkequal('', '123', 'replace', '123', '')
667 self.checkequal('', '123123', 'replace', '123', '')
668 self.checkequal('x', '123x123', 'replace', '123', '')
685 self.checkequal(' hello ', ' hello ', 'capitalize')
686 self.checkequal('Hello ', 'Hello ','capitalize')
687 self.checkequal('Hello ', 'hello ','capitalize')
688 self.checkequal('Aaaa', 'aaaa', 'capitalize')
689 self.checkequal('Aaaa', 'AaAa', 'capitalize')
694 self.checkequal(['this', 'is', 'the', 'split', 'function'],
698 self.checkequal(['a', 'b', 'c', 'd'], 'a b c d ', 'split')
699 self.checkequal(['a', 'b c d'], 'a b c d', 'split', None, 1)
700 self.checkequal(['a', 'b', 'c d'], 'a b c d', 'split', None, 2)
701 self.checkequal(['a', 'b', 'c', 'd'], 'a b c d', 'split', None, 3)
702 self.checkequal(['a', 'b', 'c', 'd'], 'a b c d', 'split', None, 4)
703 self.checkequal(['a', 'b', 'c', 'd'], 'a b c d', 'split', None,
705 self.checkequal(['a b c d'], 'a b c d', 'split', None, 0)
706 self.checkequal(['a b c d'], ' a b c d', 'split', None, 0)
707 self.checkequal(['a', 'b', 'c d'], 'a b c d', 'split', None, 2)
709 self.checkequal([], ' ', 'split')
710 self.checkequal(['a'], ' a ', 'split')
711 self.checkequal(['a', 'b'], ' a b ', 'split')
712 self.checkequal(['a', 'b '], ' a b ', 'split', None, 1)
713 self.checkequal(['a b c '], ' a b c ', 'split', None, 0)
714 self.checkequal(['a', 'b c '], ' a b c ', 'split', None, 1)
715 self.checkequal(['a', 'b', 'c '], ' a b c ', 'split', None, 2)
716 self.checkequal(['a', 'b', 'c'], ' a b c ', 'split', None, 3)
717 self.checkequal(['a', 'b'], '\n\ta \t\r b \v ', 'split')
719 self.checkequal(['a']*20, aaa, 'split')
720 self.checkequal(['a'] + [aaa[4:]], aaa, 'split', None, 1)
721 self.checkequal(['a']*19 + ['a '], aaa, 'split', None, 19)
725 self.checkequal(['arf', 'barf'], b, 'split')
726 self.checkequal(['arf', 'barf'], b, 'split', None)
727 self.checkequal(['arf', 'barf'], b, 'split', None, 2)
730 self.checkequal(['this', 'is', 'the', 'rsplit', 'function'],
734 self.checkequal(['a', 'b', 'c', 'd'], 'a b c d ', 'rsplit')
735 self.checkequal(['a b c', 'd'], 'a b c d', 'rsplit', None, 1)
736 self.checkequal(['a b', 'c', 'd'], 'a b c d', 'rsplit', None, 2)
737 self.checkequal(['a', 'b', 'c', 'd'], 'a b c d', 'rsplit', None, 3)
738 self.checkequal(['a', 'b', 'c', 'd'], 'a b c d', 'rsplit', None, 4)
739 self.checkequal(['a', 'b', 'c', 'd'], 'a b c d', 'rsplit', None,
741 self.checkequal(['a b c d'], 'a b c d', 'rsplit', None, 0)
742 self.checkequal(['a b c d'], 'a b c d ', 'rsplit', None, 0)
743 self.checkequal(['a b', 'c', 'd'], 'a b c d', 'rsplit', None, 2)
745 self.checkequal([], ' ', 'rsplit')
746 self.checkequal(['a'], ' a ', 'rsplit')
747 self.checkequal(['a', 'b'], ' a b ', 'rsplit')
748 self.checkequal([' a', 'b'], ' a b ', 'rsplit', None, 1)
749 self.checkequal([' a b c'], ' a b c ', 'rsplit',
751 self.checkequal([' a b','c'], ' a b c ', 'rsplit',
753 self.checkequal([' a', 'b', 'c'], ' a b c ', 'rsplit',
755 self.checkequal(['a', 'b', 'c'], ' a b c ', 'rsplit',
757 self.checkequal(['a', 'b'], '\n\ta \t\r b \v ', 'rsplit', None, 88)
759 self.checkequal(['a']*20, aaa, 'rsplit')
760 self.checkequal([aaa[:-4]] + ['a'], aaa, 'rsplit', None, 1)
761 self.checkequal([' a a'] + ['a']*18, aaa, 'rsplit', None, 18)
765 self.checkequal(['arf', 'barf'], b, 'rsplit')
766 self.checkequal(['arf', 'barf'], b, 'rsplit', None)
767 self.checkequal(['arf', 'barf'], b, 'rsplit', None, 2)
770 self.checkequal('hello', ' hello ', 'strip')
771 self.checkequal('hello ', ' hello ', 'lstrip')
772 self.checkequal(' hello', ' hello ', 'rstrip')
773 self.checkequal('hello', 'hello', 'strip')
776 self.checkequal('abc', b, 'strip')
777 self.checkequal('abc \t\n\r\f\v', b, 'lstrip')
778 self.checkequal(' \t\n\r\f\vabc', b, 'rstrip')
781 self.checkequal('hello', ' hello ', 'strip', None)
782 self.checkequal('hello ', ' hello ', 'lstrip', None)
783 self.checkequal(' hello', ' hello ', 'rstrip', None)
784 self.checkequal('hello', 'hello', 'strip', None)
788 self.checkequal('hello', 'xyzzyhelloxyzzy', 'strip', 'xyz')
789 self.checkequal('helloxyzzy', 'xyzzyhelloxyzzy', 'lstrip', 'xyz')
790 self.checkequal('xyzzyhello', 'xyzzyhelloxyzzy', 'rstrip', 'xyz')
791 self.checkequal('hello', 'hello', 'strip', 'xyz')
792 self.checkequal('', 'mississippi', 'strip', 'mississippi')
795 self.checkequal('mississipp', 'mississippi', 'strip', 'i')
802 self.checkequal('abc ', 'abc', 'ljust', 10)
803 self.checkequal('abc ', 'abc', 'ljust', 6)
804 self.checkequal('abc', 'abc', 'ljust', 3)
805 self.checkequal('abc', 'abc', 'ljust', 2)
806 self.checkequal('abc*******', 'abc', 'ljust', 10, '*')
810 self.checkequal(' abc', 'abc', 'rjust', 10)
811 self.checkequal(' abc', 'abc', 'rjust', 6)
812 self.checkequal('abc', 'abc', 'rjust', 3)
813 self.checkequal('abc', 'abc', 'rjust', 2)
814 self.checkequal('*******abc', 'abc', 'rjust', 10, '*')
818 self.checkequal(' abc ', 'abc', 'center', 10)
819 self.checkequal(' abc ', 'abc', 'center', 6)
820 self.checkequal('abc', 'abc', 'center', 3)
821 self.checkequal('abc', 'abc', 'center', 2)
822 self.checkequal('***abc****', 'abc', 'center', 10, '*')
826 self.checkequal('hEllO CoMPuTErS', 'HeLLo cOmpUteRs', 'swapcase')
831 self.checkequal('123', '123', 'zfill', 2)
832 self.checkequal('123', '123', 'zfill', 3)
833 self.checkequal('0123', '123', 'zfill', 4)
834 self.checkequal('+123', '+123', 'zfill', 3)
835 self.checkequal('+123', '+123', 'zfill', 4)
836 self.checkequal('+0123', '+123', 'zfill', 5)
837 self.checkequal('-123', '-123', 'zfill', 3)
838 self.checkequal('-123', '-123', 'zfill', 4)
839 self.checkequal('-0123', '-123', 'zfill', 5)
840 self.checkequal('000', '', 'zfill', 3)
841 self.checkequal('34', '34', 'zfill', 1)
842 self.checkequal('0034', '34', 'zfill', 4)
847 self.checkequal(False, '', 'islower')
848 self.checkequal(True, 'a', 'islower')
849 self.checkequal(False, 'A', 'islower')
850 self.checkequal(False, '\n', 'islower')
851 self.checkequal(True, 'abc', 'islower')
852 self.checkequal(False, 'aBc', 'islower')
853 self.checkequal(True, 'abc\n', 'islower')
857 self.checkequal(False, '', 'isupper')
858 self.checkequal(False, 'a', 'isupper')
859 self.checkequal(True, 'A', 'isupper')
860 self.checkequal(False, '\n', 'isupper')
861 self.checkequal(True, 'ABC', 'isupper')
862 self.checkequal(False, 'AbC', 'isupper')
863 self.checkequal(True, 'ABC\n', 'isupper')
867 self.checkequal(False, '', 'istitle')
868 self.checkequal(False, 'a', 'istitle')
869 self.checkequal(True, 'A', 'istitle')
870 self.checkequal(False, '\n', 'istitle')
871 self.checkequal(True, 'A Titlecased Line', 'istitle')
872 self.checkequal(True, 'A\nTitlecased Line', 'istitle')
873 self.checkequal(True, 'A Titlecased, Line', 'istitle')
874 self.checkequal(False, 'Not a capitalized String', 'istitle')
875 self.checkequal(False, 'Not\ta Titlecase String', 'istitle')
876 self.checkequal(False, 'Not--a Titlecase String', 'istitle')
877 self.checkequal(False, 'NOT', 'istitle')
881 self.checkequal(False, '', 'isspace')
882 self.checkequal(False, 'a', 'isspace')
883 self.checkequal(True, ' ', 'isspace')
884 self.checkequal(True, '\t', 'isspace')
885 self.checkequal(True, '\r', 'isspace')
886 self.checkequal(True, '\n', 'isspace')
887 self.checkequal(True, ' \t\r\n', 'isspace')
888 self.checkequal(False, ' \t\r\na', 'isspace')
892 self.checkequal(False, '', 'isalpha')
893 self.checkequal(True, 'a', 'isalpha')
894 self.checkequal(True, 'A', 'isalpha')
895 self.checkequal(False, '\n', 'isalpha')
896 self.checkequal(True, 'abc', 'isalpha')
897 self.checkequal(False, 'aBc123', 'isalpha')
898 self.checkequal(False, 'abc\n', 'isalpha')
902 self.checkequal(False, '', 'isalnum')
903 self.checkequal(True, 'a', 'isalnum')
904 self.checkequal(True, 'A', 'isalnum')
905 self.checkequal(False, '\n', 'isalnum')
906 self.checkequal(True, '123abc456', 'isalnum')
907 self.checkequal(True, 'a1b3c', 'isalnum')
908 self.checkequal(False, 'aBc000 ', 'isalnum')
909 self.checkequal(False, 'abc\n', 'isalnum')
913 self.checkequal(True, '', 'isascii')
914 self.checkequal(True, '\x00', 'isascii')
915 self.checkequal(True, '\x7f', 'isascii')
916 self.checkequal(True, '\x00\x7f', 'isascii')
917 self.checkequal(False, '\x80', 'isascii')
918 self.checkequal(False, '\xe9', 'isascii')
922 self.checkequal(True, ' '*p + '\x7f', 'isascii')
923 self.checkequal(False, ' '*p + '\x80', 'isascii')
924 self.checkequal(True, ' '*p + '\x7f' + ' '*8, 'isascii')
925 self.checkequal(False, ' '*p + '\x80' + ' '*8, 'isascii')
928 self.checkequal(False, '', 'isdigit')
929 self.checkequal(False, 'a', 'isdigit')
930 self.checkequal(True, '0', 'isdigit')
931 self.checkequal(True, '0123456789', 'isdigit')
932 self.checkequal(False, '0123456789a', 'isdigit')
937 self.checkequal(' Hello ', ' hello ', 'title')
938 self.checkequal('Hello ', 'hello ', 'title')
939 self.checkequal('Hello ', 'Hello ', 'title')
940 self.checkequal('Format This As Title String', "fOrMaT thIs aS titLe String", 'title')
941 self.checkequal('Format,This-As*Title;String', "fOrMaT,thIs-aS*titLe;String", 'title', )
942 self.checkequal('Getint', "getInt", 'title')
946 self.checkequal(['abc', 'def', '', 'ghi'], "abc\ndef\n\rghi", 'splitlines')
947 self.checkequal(['abc', 'def', '', 'ghi'], "abc\ndef\n\r\nghi", 'splitlines')
948 self.checkequal(['abc', 'def', 'ghi'], "abc\ndef\r\nghi", 'splitlines')
949 self.checkequal(['abc', 'def', 'ghi'], "abc\ndef\r\nghi\n", 'splitlines')
950 self.checkequal(['abc', 'def', 'ghi', ''], "abc\ndef\r\nghi\n\r", 'splitlines')
951 self.checkequal(['', 'abc', 'def', 'ghi', ''], "\nabc\ndef\r\nghi\n\r", 'splitlines')
952 self.checkequal(['', 'abc', 'def', 'ghi', ''],
954 self.checkequal(['\n', 'abc\n', 'def\r\n', 'ghi\n', '\r'],
956 self.checkequal(['', 'abc', 'def', 'ghi', ''], "\nabc\ndef\r\nghi\n\r",
958 self.checkequal(['\n', 'abc\n', 'def\r\n', 'ghi\n', '\r'],
980 self.checkequal('\u1ffc\u1ff3\u1ff3\u1ff3',
983 self.checkequal('\u24c5\u24e8\u24e3\u24d7\u24de\u24dd',
985 self.checkequal('\u24c5\u24e8\u24e3\u24d7\u24de\u24dd',
987 self.checkequal('\u2160\u2171\u2172',
989 self.checkequal('\u2160\u2171\u2172',
992 self.checkequal('\u019b\u1d00\u1d86\u0221\u1fb7',
1001 self.checkequal(True, 'hello', 'startswith', 'he')
1002 self.checkequal(True, 'hello', 'startswith', 'hello')
1003 self.checkequal(False, 'hello', 'startswith', 'hello world')
1004 self.checkequal(True, 'hello', 'startswith', '')
1005 self.checkequal(False, 'hello', 'startswith', 'ello')
1006 self.checkequal(True, 'hello', 'startswith', 'ello', 1)
1007 self.checkequal(True, 'hello', 'startswith', 'o', 4)
1008 self.checkequal(False, 'hello', 'startswith', 'o', 5)
1009 self.checkequal(True, 'hello', 'startswith', '', 5)
1010 self.checkequal(False, 'hello', 'startswith', 'lo', 6)
1011 self.checkequal(True, 'helloworld', 'startswith', 'lowo', 3)
1012 self.checkequal(True, 'helloworld', 'startswith', 'lowo', 3, 7)
1013 self.checkequal(False, 'helloworld', 'startswith', 'lowo', 3, 6)
1014 self.checkequal(True, '', 'startswith', '', 0, 1)
1015 self.checkequal(True, '', 'startswith', '', 0, 0)
1016 self.checkequal(False, '', 'startswith', '', 1, 0)
1019 self.checkequal(True, 'hello', 'startswith', 'he', 0, -1)
1020 self.checkequal(True, 'hello', 'startswith', 'he', -53, -1)
1021 self.checkequal(False, 'hello', 'startswith', 'hello', 0, -1)
1022 self.checkequal(False, 'hello', 'startswith', 'hello world', -1, -10)
1023 self.checkequal(False, 'hello', 'startswith', 'ello', -5)
1024 self.checkequal(True, 'hello', 'startswith', 'ello', -4)
1025 self.checkequal(False, 'hello', 'startswith', 'o', -2)
1026 self.checkequal(True, 'hello', 'startswith', 'o', -1)
1027 self.checkequal(True, 'hello', 'startswith', '', -3, -3)
1028 self.checkequal(False, 'hello', 'startswith', 'lo', -9)
1034 self.checkequal(True, 'hello', 'startswith', ('he', 'ha'))
1035 self.checkequal(False, 'hello', 'startswith', ('lo', 'llo'))
1036 self.checkequal(True, 'hello', 'startswith', ('hellox', 'hello'))
1037 self.checkequal(False, 'hello', 'startswith', ())
1038 self.checkequal(True, 'helloworld', 'startswith', ('hellowo',
1040 self.checkequal(False, 'helloworld', 'startswith', ('hellowo', 'ello',
1042 self.checkequal(True, 'hello', 'startswith', ('lo', 'he'), 0, -1)
1043 self.checkequal(False, 'hello', 'startswith', ('he', 'hel'), 0, 1)
1044 self.checkequal(True, 'hello', 'startswith', ('he', 'hel'), 0, 2)
1049 self.checkequal(True, 'hello', 'endswith', 'lo')
1050 self.checkequal(False, 'hello', 'endswith', 'he')
1051 self.checkequal(True, 'hello', 'endswith', '')
1052 self.checkequal(False, 'hello', 'endswith', 'hello world')
1053 self.checkequal(False, 'helloworld', 'endswith', 'worl')
1054 self.checkequal(True, 'helloworld', 'endswith', 'worl', 3, 9)
1055 self.checkequal(True, 'helloworld', 'endswith', 'world', 3, 12)
1056 self.checkequal(True, 'helloworld', 'endswith', 'lowo', 1, 7)
1057 self.checkequal(True, 'helloworld', 'endswith', 'lowo', 2, 7)
1058 self.checkequal(True, 'helloworld', 'endswith', 'lowo', 3, 7)
1059 self.checkequal(False, 'helloworld', 'endswith', 'lowo', 4, 7)
1060 self.checkequal(False, 'helloworld', 'endswith', 'lowo', 3, 8)
1061 self.checkequal(False, 'ab', 'endswith', 'ab', 0, 1)
1062 self.checkequal(False, 'ab', 'endswith', 'ab', 0, 0)
1063 self.checkequal(True, '', 'endswith', '', 0, 1)
1064 self.checkequal(True, '', 'endswith', '', 0, 0)
1065 self.checkequal(False, '', 'endswith', '', 1, 0)
1068 self.checkequal(True, 'hello', 'endswith', 'lo', -2)
1069 self.checkequal(False, 'hello', 'endswith', 'he', -2)
1070 self.checkequal(True, 'hello', 'endswith', '', -3, -3)
1071 self.checkequal(False, 'hello', 'endswith', 'hello world', -10, -2)
1072 self.checkequal(False, 'helloworld', 'endswith', 'worl', -6)
1073 self.checkequal(True, 'helloworld', 'endswith', 'worl', -5, -1)
1074 self.checkequal(True, 'helloworld', 'endswith', 'worl', -5, 9)
1075 self.checkequal(True, 'helloworld', 'endswith', 'world', -7, 12)
1076 self.checkequal(True, 'helloworld', 'endswith', 'lowo', -99, -3)
1077 self.checkequal(True, 'helloworld', 'endswith', 'lowo', -8, -3)
1078 self.checkequal(True, 'helloworld', 'endswith', 'lowo', -7, -3)
1079 self.checkequal(False, 'helloworld', 'endswith', 'lowo', 3, -4)
1080 self.checkequal(False, 'helloworld', 'endswith', 'lowo', -8, -2)
1086 self.checkequal(False, 'hello', 'endswith', ('he', 'ha'))
1087 self.checkequal(True, 'hello', 'endswith', ('lo', 'llo'))
1088 self.checkequal(True, 'hello', 'endswith', ('hellox', 'hello'))
1089 self.checkequal(False, 'hello', 'endswith', ())
1090 self.checkequal(True, 'helloworld', 'endswith', ('hellowo',
1092 self.checkequal(False, 'helloworld', 'endswith', ('hellowo', 'ello',
1094 self.checkequal(True, 'hello', 'endswith', ('hell', 'ell'), 0, -1)
1095 self.checkequal(False, 'hello', 'endswith', ('he', 'hel'), 0, 1)
1096 self.checkequal(True, 'hello', 'endswith', ('he', 'hell'), 0, 4)
1101 self.checkequal(True, '', '__contains__', '')
1102 self.checkequal(True, 'abc', '__contains__', '')
1103 self.checkequal(False, 'abc', '__contains__', '\0')
1104 self.checkequal(True, '\0abc', '__contains__', '\0')
1105 self.checkequal(True, 'abc\0', '__contains__', '\0')
1106 self.checkequal(True, '\0abc', '__contains__', 'a')
1107 self.checkequal(True, 'asdf', '__contains__', 'asdf')
1108 self.checkequal(False, 'asd', '__contains__', 'asdf')
1109 self.checkequal(False, '', '__contains__', 'asdf')
1112 self.checkequal('a', 'abc', '__getitem__', 0)
1113 self.checkequal('c', 'abc', '__getitem__', -1)
1114 self.checkequal('a', 'abc', '__getitem__', 0)
1115 self.checkequal('abc', 'abc', '__getitem__', slice(0, 3))
1116 self.checkequal('abc', 'abc', '__getitem__', slice(0, 1000))
1117 self.checkequal('a', 'abc', '__getitem__', slice(0, 1))
1118 self.checkequal('', 'abc', '__getitem__', slice(0, 0))
1123 self.checkequal('abc', 'abc', '__getitem__', slice(0, 1000))
1124 self.checkequal('abc', 'abc', '__getitem__', slice(0, 3))
1125 self.checkequal('ab', 'abc', '__getitem__', slice(0, 2))
1126 self.checkequal('bc', 'abc', '__getitem__', slice(1, 3))
1127 self.checkequal('b', 'abc', '__getitem__', slice(1, 2))
1128 self.checkequal('', 'abc', '__getitem__', slice(2, 2))
1129 self.checkequal('', 'abc', '__getitem__', slice(1000, 1000))
1130 self.checkequal('', 'abc', '__getitem__', slice(2000, 1000))
1131 self.checkequal('', 'abc', '__getitem__', slice(2, 1))
1144 self.checkequal("".join(L), s, '__getitem__',
1148 self.checkequal('', 'abc', '__mul__', -1)
1149 self.checkequal('', 'abc', '__mul__', 0)
1150 self.checkequal('abc', 'abc', '__mul__', 1)
1151 self.checkequal('abcabcabc', 'abc', '__mul__', 3)
1162 self.checkequal('a b c d', ' ', 'join', ['a', 'b', 'c', 'd'])
1163 self.checkequal('abcd', '', 'join', ('a', 'b', 'c', 'd'))
1164 self.checkequal('bd', '', 'join', ('', 'b', '', 'd'))
1165 self.checkequal('ac', '', 'join', ('a', '', 'c', ''))
1166 self.checkequal('w x y z', ' ', 'join', Sequence())
1167 self.checkequal('abc', 'a', 'join', ('abc',))
1168 self.checkequal('z', 'a', 'join', UserList(['z']))
1169 self.checkequal('a.b.c', '.', 'join', ['a', 'b', 'c'])
1172 self.checkequal(((('a' * i) + '-') * i)[:-1], '-', 'join',
1174 self.checkequal(((('a' * i) + '-') * i)[:-1], '-', 'join',
1178 self.checkequal('a b c', ' ', 'join', BadSeq2())
1195 self.checkequal('+hello+', '+%s+', '__mod__', 'hello')
1196 self.checkequal('+10+', '+%d+', '__mod__', 10)
1197 self.checkequal('a', "%c", '__mod__', "a")
1198 self.checkequal('a', "%c", '__mod__', "a")
1199 self.checkequal('"', "%c", '__mod__', 34)
1200 self.checkequal('$', "%c", '__mod__', 36)
1201 self.checkequal('10', "%d", '__mod__', 10)
1202 self.checkequal('\x7f', "%c", '__mod__', 0x7f)
1210 self.checkequal(' 42', '%3ld', '__mod__', 42)
1211 self.checkequal('42', '%d', '__mod__', 42.0)
1212 self.checkequal(slongvalue, '%d', '__mod__', longvalue)
1214 self.checkequal('0042.00', '%07.2f', '__mod__', 42)
1215 self.checkequal('0042.00', '%07.2F', '__mod__', 42)
1227 self.checkequal('bar', '%((foo))s', '__mod__', {'(foo)': 'bar'})
1230 self.checkequal(103*'a'+'x', '%sx', '__mod__', 103*'a')
1272 self.checkequal('a', 'A', 'lower')
1273 self.checkequal(True, 'A', 'isupper')
1274 self.checkequal('A', 'a', 'upper')
1275 self.checkequal(True, 'a', 'islower')
1277 self.checkequal('a', 'A', 'replace', 'A', 'a')
1278 self.checkequal(True, 'A', 'isupper')
1280 self.checkequal('A', 'a', 'capitalize')
1281 self.checkequal(True, 'a', 'islower')
1283 self.checkequal('A', 'a', 'swapcase')
1284 self.checkequal(True, 'a', 'islower')
1286 self.checkequal('A', 'a', 'title')
1287 self.checkequal(True, 'a', 'islower')
1291 self.checkequal(('this is the par', 'ti', 'tion method'),
1296 self.checkequal(('http', '://', 'www.python.org'), S, 'partition', '://')
1297 self.checkequal(('http://www.python.org', '', ''), S, 'partition', '?')
1298 self.checkequal(('', 'http://', 'www.python.org'), S, 'partition', 'http://')
1299 self.checkequal(('http://www.python.', 'org', ''), S, 'partition', 'org')
1306 self.checkequal(('this is the rparti', 'ti', 'on method'),
1311 self.checkequal(('http', '://', 'www.python.org'), S, 'rpartition', '://')
1312 self.checkequal(('', '', 'http://www.python.org'), S, 'rpartition', '?')
1313 self.checkequal(('', 'http://', 'www.python.org'), S, 'rpartition', 'http://')
1314 self.checkequal(('http://www.python.', 'org', ''), S, 'rpartition', 'org')
1322 self.checkequal(2, s, 'find', 'l', None)
1323 self.checkequal(3, s, 'find', 'l', -2, None)
1324 self.checkequal(2, s, 'find', 'l', None, -2)
1325 self.checkequal(0, s, 'find', 'h', None, None)
1327 self.checkequal(3, s, 'rfind', 'l', None)
1328 self.checkequal(3, s, 'rfind', 'l', -2, None)
1329 self.checkequal(2, s, 'rfind', 'l', None, -2)
1330 self.checkequal(0, s, 'rfind', 'h', None, None)
1332 self.checkequal(2, s, 'index', 'l', None)
1333 self.checkequal(3, s, 'index', 'l', -2, None)
1334 self.checkequal(2, s, 'index', 'l', None, -2)
1335 self.checkequal(0, s, 'index', 'h', None, None)
1337 self.checkequal(3, s, 'rindex', 'l', None)
1338 self.checkequal(3, s, 'rindex', 'l', -2, None)
1339 self.checkequal(2, s, 'rindex', 'l', None, -2)
1340 self.checkequal(0, s, 'rindex', 'h', None, None)
1342 self.checkequal(2, s, 'count', 'l', None)
1343 self.checkequal(1, s, 'count', 'l', -2, None)
1344 self.checkequal(1, s, 'count', 'l', None, -2)
1345 self.checkequal(0, s, 'count', 'x', None, None)
1347 self.checkequal(True, s, 'endswith', 'o', None)
1348 self.checkequal(True, s, 'endswith', 'lo', -2, None)
1349 self.checkequal(True, s, 'endswith', 'l', None, -2)
1350 self.checkequal(False, s, 'endswith', 'x', None, None)
1352 self.checkequal(True, s, 'startswith', 'h', None)
1353 self.checkequal(True, s, 'startswith', 'l', -2, None)
1354 self.checkequal(True, s, 'startswith', 'h', None, -2)
1355 self.checkequal(False, s, 'startswith', 'x', None, None)
1377 self.checkequal(10, "...\u043c......<", "find", "<")