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
649 self.checkequal('one@two!three!', 'one!two!three!', 'replace', '!', '@', 1)
650 self.checkequal('onetwothree', 'one!two!three!', 'replace', '!', '')
651 self.checkequal('one@two@three!', 'one!two!three!', 'replace', '!', '@', 2)
652 self.checkequal('one@two@three@', 'one!two!three!', 'replace', '!', '@', 3)
653 self.checkequal('one@two@three@', 'one!two!three!', 'replace', '!', '@', 4)
654 self.checkequal('one!two!three!', 'one!two!three!', 'replace', '!', '@', 0)
655 self.checkequal('one@two@three@', 'one!two!three!', 'replace', '!', '@')
656 self.checkequal('one!two!three!', 'one!two!three!', 'replace', 'x', '@')
657 self.checkequal('one!two!three!', 'one!two!three!', 'replace', 'x', '@', 2)
658 self.checkequal('-a-b-c-', 'abc', 'replace', '', '-')
659 self.checkequal('-a-b-c', 'abc', 'replace', '', '-', 3)
660 self.checkequal('abc', 'abc', 'replace', '', '-', 0)
661 self.checkequal('', '', 'replace', '', '')
662 self.checkequal('abc', 'abc', 'replace', 'ab', '--', 0)
663 self.checkequal('abc', 'abc', 'replace', 'xy', '--')
667 self.checkequal('', '123', 'replace', '123', '')
668 self.checkequal('', '123123', 'replace', '123', '')
669 self.checkequal('x', '123x123', 'replace', '123', '')
686 self.checkequal('am', 'spam', 'removeprefix', 'sp')
687 self.checkequal('spamspam', 'spamspamspam', 'removeprefix', 'spam')
688 self.checkequal('spam', 'spam', 'removeprefix', 'python')
689 self.checkequal('spam', 'spam', 'removeprefix', 'spider')
690 self.checkequal('spam', 'spam', 'removeprefix', 'spam and eggs')
692 self.checkequal('', '', 'removeprefix', '')
693 self.checkequal('', '', 'removeprefix', 'abcde')
694 self.checkequal('abcde', 'abcde', 'removeprefix', '')
695 self.checkequal('', 'abcde', 'removeprefix', 'abcde')
704 self.checkequal('sp', 'spam', 'removesuffix', 'am')
705 self.checkequal('spamspam', 'spamspamspam', 'removesuffix', 'spam')
706 self.checkequal('spam', 'spam', 'removesuffix', 'python')
707 self.checkequal('spam', 'spam', 'removesuffix', 'blam')
708 self.checkequal('spam', 'spam', 'removesuffix', 'eggs and spam')
710 self.checkequal('', '', 'removesuffix', '')
711 self.checkequal('', '', 'removesuffix', 'abcde')
712 self.checkequal('abcde', 'abcde', 'removesuffix', '')
713 self.checkequal('', 'abcde', 'removesuffix', 'abcde')
722 self.checkequal(' hello ', ' hello ', 'capitalize')
723 self.checkequal('Hello ', 'Hello ','capitalize')
724 self.checkequal('Hello ', 'hello ','capitalize')
725 self.checkequal('Aaaa', 'aaaa', 'capitalize')
726 self.checkequal('Aaaa', 'AaAa', 'capitalize')
731 self.checkequal(['this', 'is', 'the', 'split', 'function'],
735 self.checkequal(['a', 'b', 'c', 'd'], 'a b c d ', 'split')
736 self.checkequal(['a', 'b c d'], 'a b c d', 'split', None, 1)
737 self.checkequal(['a', 'b', 'c d'], 'a b c d', 'split', None, 2)
738 self.checkequal(['a', 'b', 'c', 'd'], 'a b c d', 'split', None, 3)
739 self.checkequal(['a', 'b', 'c', 'd'], 'a b c d', 'split', None, 4)
740 self.checkequal(['a', 'b', 'c', 'd'], 'a b c d', 'split', None,
742 self.checkequal(['a b c d'], 'a b c d', 'split', None, 0)
743 self.checkequal(['a b c d'], ' a b c d', 'split', None, 0)
744 self.checkequal(['a', 'b', 'c d'], 'a b c d', 'split', None, 2)
746 self.checkequal([], ' ', 'split')
747 self.checkequal(['a'], ' a ', 'split')
748 self.checkequal(['a', 'b'], ' a b ', 'split')
749 self.checkequal(['a', 'b '], ' a b ', 'split', None, 1)
750 self.checkequal(['a b c '], ' a b c ', 'split', None, 0)
751 self.checkequal(['a', 'b c '], ' a b c ', 'split', None, 1)
752 self.checkequal(['a', 'b', 'c '], ' a b c ', 'split', None, 2)
753 self.checkequal(['a', 'b', 'c'], ' a b c ', 'split', None, 3)
754 self.checkequal(['a', 'b'], '\n\ta \t\r b \v ', 'split')
756 self.checkequal(['a']*20, aaa, 'split')
757 self.checkequal(['a'] + [aaa[4:]], aaa, 'split', None, 1)
758 self.checkequal(['a']*19 + ['a '], aaa, 'split', None, 19)
762 self.checkequal(['arf', 'barf'], b, 'split')
763 self.checkequal(['arf', 'barf'], b, 'split', None)
764 self.checkequal(['arf', 'barf'], b, 'split', None, 2)
767 self.checkequal(['this', 'is', 'the', 'rsplit', 'function'],
771 self.checkequal(['a', 'b', 'c', 'd'], 'a b c d ', 'rsplit')
772 self.checkequal(['a b c', 'd'], 'a b c d', 'rsplit', None, 1)
773 self.checkequal(['a b', 'c', 'd'], 'a b c d', 'rsplit', None, 2)
774 self.checkequal(['a', 'b', 'c', 'd'], 'a b c d', 'rsplit', None, 3)
775 self.checkequal(['a', 'b', 'c', 'd'], 'a b c d', 'rsplit', None, 4)
776 self.checkequal(['a', 'b', 'c', 'd'], 'a b c d', 'rsplit', None,
778 self.checkequal(['a b c d'], 'a b c d', 'rsplit', None, 0)
779 self.checkequal(['a b c d'], 'a b c d ', 'rsplit', None, 0)
780 self.checkequal(['a b', 'c', 'd'], 'a b c d', 'rsplit', None, 2)
782 self.checkequal([], ' ', 'rsplit')
783 self.checkequal(['a'], ' a ', 'rsplit')
784 self.checkequal(['a', 'b'], ' a b ', 'rsplit')
785 self.checkequal([' a', 'b'], ' a b ', 'rsplit', None, 1)
786 self.checkequal([' a b c'], ' a b c ', 'rsplit',
788 self.checkequal([' a b','c'], ' a b c ', 'rsplit',
790 self.checkequal([' a', 'b', 'c'], ' a b c ', 'rsplit',
792 self.checkequal(['a', 'b', 'c'], ' a b c ', 'rsplit',
794 self.checkequal(['a', 'b'], '\n\ta \t\r b \v ', 'rsplit', None, 88)
796 self.checkequal(['a']*20, aaa, 'rsplit')
797 self.checkequal([aaa[:-4]] + ['a'], aaa, 'rsplit', None, 1)
798 self.checkequal([' a a'] + ['a']*18, aaa, 'rsplit', None, 18)
802 self.checkequal(['arf', 'barf'], b, 'rsplit')
803 self.checkequal(['arf', 'barf'], b, 'rsplit', None)
804 self.checkequal(['arf', 'barf'], b, 'rsplit', None, 2)
807 self.checkequal('hello', ' hello ', 'strip')
808 self.checkequal('hello ', ' hello ', 'lstrip')
809 self.checkequal(' hello', ' hello ', 'rstrip')
810 self.checkequal('hello', 'hello', 'strip')
813 self.checkequal('abc', b, 'strip')
814 self.checkequal('abc \t\n\r\f\v', b, 'lstrip')
815 self.checkequal(' \t\n\r\f\vabc', b, 'rstrip')
818 self.checkequal('hello', ' hello ', 'strip', None)
819 self.checkequal('hello ', ' hello ', 'lstrip', None)
820 self.checkequal(' hello', ' hello ', 'rstrip', None)
821 self.checkequal('hello', 'hello', 'strip', None)
825 self.checkequal('hello', 'xyzzyhelloxyzzy', 'strip', 'xyz')
826 self.checkequal('helloxyzzy', 'xyzzyhelloxyzzy', 'lstrip', 'xyz')
827 self.checkequal('xyzzyhello', 'xyzzyhelloxyzzy', 'rstrip', 'xyz')
828 self.checkequal('hello', 'hello', 'strip', 'xyz')
829 self.checkequal('', 'mississippi', 'strip', 'mississippi')
832 self.checkequal('mississipp', 'mississippi', 'strip', 'i')
839 self.checkequal('abc ', 'abc', 'ljust', 10)
840 self.checkequal('abc ', 'abc', 'ljust', 6)
841 self.checkequal('abc', 'abc', 'ljust', 3)
842 self.checkequal('abc', 'abc', 'ljust', 2)
843 self.checkequal('abc*******', 'abc', 'ljust', 10, '*')
847 self.checkequal(' abc', 'abc', 'rjust', 10)
848 self.checkequal(' abc', 'abc', 'rjust', 6)
849 self.checkequal('abc', 'abc', 'rjust', 3)
850 self.checkequal('abc', 'abc', 'rjust', 2)
851 self.checkequal('*******abc', 'abc', 'rjust', 10, '*')
855 self.checkequal(' abc ', 'abc', 'center', 10)
856 self.checkequal(' abc ', 'abc', 'center', 6)
857 self.checkequal('abc', 'abc', 'center', 3)
858 self.checkequal('abc', 'abc', 'center', 2)
859 self.checkequal('***abc****', 'abc', 'center', 10, '*')
863 self.checkequal('hEllO CoMPuTErS', 'HeLLo cOmpUteRs', 'swapcase')
868 self.checkequal('123', '123', 'zfill', 2)
869 self.checkequal('123', '123', 'zfill', 3)
870 self.checkequal('0123', '123', 'zfill', 4)
871 self.checkequal('+123', '+123', 'zfill', 3)
872 self.checkequal('+123', '+123', 'zfill', 4)
873 self.checkequal('+0123', '+123', 'zfill', 5)
874 self.checkequal('-123', '-123', 'zfill', 3)
875 self.checkequal('-123', '-123', 'zfill', 4)
876 self.checkequal('-0123', '-123', 'zfill', 5)
877 self.checkequal('000', '', 'zfill', 3)
878 self.checkequal('34', '34', 'zfill', 1)
879 self.checkequal('0034', '34', 'zfill', 4)
884 self.checkequal(False, '', 'islower')
885 self.checkequal(True, 'a', 'islower')
886 self.checkequal(False, 'A', 'islower')
887 self.checkequal(False, '\n', 'islower')
888 self.checkequal(True, 'abc', 'islower')
889 self.checkequal(False, 'aBc', 'islower')
890 self.checkequal(True, 'abc\n', 'islower')
894 self.checkequal(False, '', 'isupper')
895 self.checkequal(False, 'a', 'isupper')
896 self.checkequal(True, 'A', 'isupper')
897 self.checkequal(False, '\n', 'isupper')
898 self.checkequal(True, 'ABC', 'isupper')
899 self.checkequal(False, 'AbC', 'isupper')
900 self.checkequal(True, 'ABC\n', 'isupper')
904 self.checkequal(False, '', 'istitle')
905 self.checkequal(False, 'a', 'istitle')
906 self.checkequal(True, 'A', 'istitle')
907 self.checkequal(False, '\n', 'istitle')
908 self.checkequal(True, 'A Titlecased Line', 'istitle')
909 self.checkequal(True, 'A\nTitlecased Line', 'istitle')
910 self.checkequal(True, 'A Titlecased, Line', 'istitle')
911 self.checkequal(False, 'Not a capitalized String', 'istitle')
912 self.checkequal(False, 'Not\ta Titlecase String', 'istitle')
913 self.checkequal(False, 'Not--a Titlecase String', 'istitle')
914 self.checkequal(False, 'NOT', 'istitle')
918 self.checkequal(False, '', 'isspace')
919 self.checkequal(False, 'a', 'isspace')
920 self.checkequal(True, ' ', 'isspace')
921 self.checkequal(True, '\t', 'isspace')
922 self.checkequal(True, '\r', 'isspace')
923 self.checkequal(True, '\n', 'isspace')
924 self.checkequal(True, ' \t\r\n', 'isspace')
925 self.checkequal(False, ' \t\r\na', 'isspace')
929 self.checkequal(False, '', 'isalpha')
930 self.checkequal(True, 'a', 'isalpha')
931 self.checkequal(True, 'A', 'isalpha')
932 self.checkequal(False, '\n', 'isalpha')
933 self.checkequal(True, 'abc', 'isalpha')
934 self.checkequal(False, 'aBc123', 'isalpha')
935 self.checkequal(False, 'abc\n', 'isalpha')
939 self.checkequal(False, '', 'isalnum')
940 self.checkequal(True, 'a', 'isalnum')
941 self.checkequal(True, 'A', 'isalnum')
942 self.checkequal(False, '\n', 'isalnum')
943 self.checkequal(True, '123abc456', 'isalnum')
944 self.checkequal(True, 'a1b3c', 'isalnum')
945 self.checkequal(False, 'aBc000 ', 'isalnum')
946 self.checkequal(False, 'abc\n', 'isalnum')
950 self.checkequal(True, '', 'isascii')
951 self.checkequal(True, '\x00', 'isascii')
952 self.checkequal(True, '\x7f', 'isascii')
953 self.checkequal(True, '\x00\x7f', 'isascii')
954 self.checkequal(False, '\x80', 'isascii')
955 self.checkequal(False, '\xe9', 'isascii')
959 self.checkequal(True, ' '*p + '\x7f', 'isascii')
960 self.checkequal(False, ' '*p + '\x80', 'isascii')
961 self.checkequal(True, ' '*p + '\x7f' + ' '*8, 'isascii')
962 self.checkequal(False, ' '*p + '\x80' + ' '*8, 'isascii')
965 self.checkequal(False, '', 'isdigit')
966 self.checkequal(False, 'a', 'isdigit')
967 self.checkequal(True, '0', 'isdigit')
968 self.checkequal(True, '0123456789', 'isdigit')
969 self.checkequal(False, '0123456789a', 'isdigit')
974 self.checkequal(' Hello ', ' hello ', 'title')
975 self.checkequal('Hello ', 'hello ', 'title')
976 self.checkequal('Hello ', 'Hello ', 'title')
977 self.checkequal('Format This As Title String', "fOrMaT thIs aS titLe String", 'title')
978 self.checkequal('Format,This-As*Title;String', "fOrMaT,thIs-aS*titLe;String", 'title', )
979 self.checkequal('Getint', "getInt", 'title')
983 self.checkequal(['abc', 'def', '', 'ghi'], "abc\ndef\n\rghi", 'splitlines')
984 self.checkequal(['abc', 'def', '', 'ghi'], "abc\ndef\n\r\nghi", 'splitlines')
985 self.checkequal(['abc', 'def', 'ghi'], "abc\ndef\r\nghi", 'splitlines')
986 self.checkequal(['abc', 'def', 'ghi'], "abc\ndef\r\nghi\n", 'splitlines')
987 self.checkequal(['abc', 'def', 'ghi', ''], "abc\ndef\r\nghi\n\r", 'splitlines')
988 self.checkequal(['', 'abc', 'def', 'ghi', ''], "\nabc\ndef\r\nghi\n\r", 'splitlines')
989 self.checkequal(['', 'abc', 'def', 'ghi', ''],
991 self.checkequal(['\n', 'abc\n', 'def\r\n', 'ghi\n', '\r'],
993 self.checkequal(['', 'abc', 'def', 'ghi', ''], "\nabc\ndef\r\nghi\n\r",
995 self.checkequal(['\n', 'abc\n', 'def\r\n', 'ghi\n', '\r'],
1017 self.checkequal('\u1ffc\u1ff3\u1ff3\u1ff3',
1020 self.checkequal('\u24c5\u24e8\u24e3\u24d7\u24de\u24dd',
1022 self.checkequal('\u24c5\u24e8\u24e3\u24d7\u24de\u24dd',
1024 self.checkequal('\u2160\u2171\u2172',
1026 self.checkequal('\u2160\u2171\u2172',
1029 self.checkequal('\u019b\u1d00\u1d86\u0221\u1fb7',
1038 self.checkequal(True, 'hello', 'startswith', 'he')
1039 self.checkequal(True, 'hello', 'startswith', 'hello')
1040 self.checkequal(False, 'hello', 'startswith', 'hello world')
1041 self.checkequal(True, 'hello', 'startswith', '')
1042 self.checkequal(False, 'hello', 'startswith', 'ello')
1043 self.checkequal(True, 'hello', 'startswith', 'ello', 1)
1044 self.checkequal(True, 'hello', 'startswith', 'o', 4)
1045 self.checkequal(False, 'hello', 'startswith', 'o', 5)
1046 self.checkequal(True, 'hello', 'startswith', '', 5)
1047 self.checkequal(False, 'hello', 'startswith', 'lo', 6)
1048 self.checkequal(True, 'helloworld', 'startswith', 'lowo', 3)
1049 self.checkequal(True, 'helloworld', 'startswith', 'lowo', 3, 7)
1050 self.checkequal(False, 'helloworld', 'startswith', 'lowo', 3, 6)
1051 self.checkequal(True, '', 'startswith', '', 0, 1)
1052 self.checkequal(True, '', 'startswith', '', 0, 0)
1053 self.checkequal(False, '', 'startswith', '', 1, 0)
1056 self.checkequal(True, 'hello', 'startswith', 'he', 0, -1)
1057 self.checkequal(True, 'hello', 'startswith', 'he', -53, -1)
1058 self.checkequal(False, 'hello', 'startswith', 'hello', 0, -1)
1059 self.checkequal(False, 'hello', 'startswith', 'hello world', -1, -10)
1060 self.checkequal(False, 'hello', 'startswith', 'ello', -5)
1061 self.checkequal(True, 'hello', 'startswith', 'ello', -4)
1062 self.checkequal(False, 'hello', 'startswith', 'o', -2)
1063 self.checkequal(True, 'hello', 'startswith', 'o', -1)
1064 self.checkequal(True, 'hello', 'startswith', '', -3, -3)
1065 self.checkequal(False, 'hello', 'startswith', 'lo', -9)
1071 self.checkequal(True, 'hello', 'startswith', ('he', 'ha'))
1072 self.checkequal(False, 'hello', 'startswith', ('lo', 'llo'))
1073 self.checkequal(True, 'hello', 'startswith', ('hellox', 'hello'))
1074 self.checkequal(False, 'hello', 'startswith', ())
1075 self.checkequal(True, 'helloworld', 'startswith', ('hellowo',
1077 self.checkequal(False, 'helloworld', 'startswith', ('hellowo', 'ello',
1079 self.checkequal(True, 'hello', 'startswith', ('lo', 'he'), 0, -1)
1080 self.checkequal(False, 'hello', 'startswith', ('he', 'hel'), 0, 1)
1081 self.checkequal(True, 'hello', 'startswith', ('he', 'hel'), 0, 2)
1086 self.checkequal(True, 'hello', 'endswith', 'lo')
1087 self.checkequal(False, 'hello', 'endswith', 'he')
1088 self.checkequal(True, 'hello', 'endswith', '')
1089 self.checkequal(False, 'hello', 'endswith', 'hello world')
1090 self.checkequal(False, 'helloworld', 'endswith', 'worl')
1091 self.checkequal(True, 'helloworld', 'endswith', 'worl', 3, 9)
1092 self.checkequal(True, 'helloworld', 'endswith', 'world', 3, 12)
1093 self.checkequal(True, 'helloworld', 'endswith', 'lowo', 1, 7)
1094 self.checkequal(True, 'helloworld', 'endswith', 'lowo', 2, 7)
1095 self.checkequal(True, 'helloworld', 'endswith', 'lowo', 3, 7)
1096 self.checkequal(False, 'helloworld', 'endswith', 'lowo', 4, 7)
1097 self.checkequal(False, 'helloworld', 'endswith', 'lowo', 3, 8)
1098 self.checkequal(False, 'ab', 'endswith', 'ab', 0, 1)
1099 self.checkequal(False, 'ab', 'endswith', 'ab', 0, 0)
1100 self.checkequal(True, '', 'endswith', '', 0, 1)
1101 self.checkequal(True, '', 'endswith', '', 0, 0)
1102 self.checkequal(False, '', 'endswith', '', 1, 0)
1105 self.checkequal(True, 'hello', 'endswith', 'lo', -2)
1106 self.checkequal(False, 'hello', 'endswith', 'he', -2)
1107 self.checkequal(True, 'hello', 'endswith', '', -3, -3)
1108 self.checkequal(False, 'hello', 'endswith', 'hello world', -10, -2)
1109 self.checkequal(False, 'helloworld', 'endswith', 'worl', -6)
1110 self.checkequal(True, 'helloworld', 'endswith', 'worl', -5, -1)
1111 self.checkequal(True, 'helloworld', 'endswith', 'worl', -5, 9)
1112 self.checkequal(True, 'helloworld', 'endswith', 'world', -7, 12)
1113 self.checkequal(True, 'helloworld', 'endswith', 'lowo', -99, -3)
1114 self.checkequal(True, 'helloworld', 'endswith', 'lowo', -8, -3)
1115 self.checkequal(True, 'helloworld', 'endswith', 'lowo', -7, -3)
1116 self.checkequal(False, 'helloworld', 'endswith', 'lowo', 3, -4)
1117 self.checkequal(False, 'helloworld', 'endswith', 'lowo', -8, -2)
1123 self.checkequal(False, 'hello', 'endswith', ('he', 'ha'))
1124 self.checkequal(True, 'hello', 'endswith', ('lo', 'llo'))
1125 self.checkequal(True, 'hello', 'endswith', ('hellox', 'hello'))
1126 self.checkequal(False, 'hello', 'endswith', ())
1127 self.checkequal(True, 'helloworld', 'endswith', ('hellowo',
1129 self.checkequal(False, 'helloworld', 'endswith', ('hellowo', 'ello',
1131 self.checkequal(True, 'hello', 'endswith', ('hell', 'ell'), 0, -1)
1132 self.checkequal(False, 'hello', 'endswith', ('he', 'hel'), 0, 1)
1133 self.checkequal(True, 'hello', 'endswith', ('he', 'hell'), 0, 4)
1138 self.checkequal(True, '', '__contains__', '')
1139 self.checkequal(True, 'abc', '__contains__', '')
1140 self.checkequal(False, 'abc', '__contains__', '\0')
1141 self.checkequal(True, '\0abc', '__contains__', '\0')
1142 self.checkequal(True, 'abc\0', '__contains__', '\0')
1143 self.checkequal(True, '\0abc', '__contains__', 'a')
1144 self.checkequal(True, 'asdf', '__contains__', 'asdf')
1145 self.checkequal(False, 'asd', '__contains__', 'asdf')
1146 self.checkequal(False, '', '__contains__', 'asdf')
1149 self.checkequal('a', 'abc', '__getitem__', 0)
1150 self.checkequal('c', 'abc', '__getitem__', -1)
1151 self.checkequal('a', 'abc', '__getitem__', 0)
1152 self.checkequal('abc', 'abc', '__getitem__', slice(0, 3))
1153 self.checkequal('abc', 'abc', '__getitem__', slice(0, 1000))
1154 self.checkequal('a', 'abc', '__getitem__', slice(0, 1))
1155 self.checkequal('', 'abc', '__getitem__', slice(0, 0))
1160 self.checkequal('abc', 'abc', '__getitem__', slice(0, 1000))
1161 self.checkequal('abc', 'abc', '__getitem__', slice(0, 3))
1162 self.checkequal('ab', 'abc', '__getitem__', slice(0, 2))
1163 self.checkequal('bc', 'abc', '__getitem__', slice(1, 3))
1164 self.checkequal('b', 'abc', '__getitem__', slice(1, 2))
1165 self.checkequal('', 'abc', '__getitem__', slice(2, 2))
1166 self.checkequal('', 'abc', '__getitem__', slice(1000, 1000))
1167 self.checkequal('', 'abc', '__getitem__', slice(2000, 1000))
1168 self.checkequal('', 'abc', '__getitem__', slice(2, 1))
1181 self.checkequal("".join(L), s, '__getitem__',
1185 self.checkequal('', 'abc', '__mul__', -1)
1186 self.checkequal('', 'abc', '__mul__', 0)
1187 self.checkequal('abc', 'abc', '__mul__', 1)
1188 self.checkequal('abcabcabc', 'abc', '__mul__', 3)
1199 self.checkequal('a b c d', ' ', 'join', ['a', 'b', 'c', 'd'])
1200 self.checkequal('abcd', '', 'join', ('a', 'b', 'c', 'd'))
1201 self.checkequal('bd', '', 'join', ('', 'b', '', 'd'))
1202 self.checkequal('ac', '', 'join', ('a', '', 'c', ''))
1203 self.checkequal('w x y z', ' ', 'join', Sequence())
1204 self.checkequal('abc', 'a', 'join', ('abc',))
1205 self.checkequal('z', 'a', 'join', UserList(['z']))
1206 self.checkequal('a.b.c', '.', 'join', ['a', 'b', 'c'])
1209 self.checkequal(((('a' * i) + '-') * i)[:-1], '-', 'join',
1211 self.checkequal(((('a' * i) + '-') * i)[:-1], '-', 'join',
1215 self.checkequal('a b c', ' ', 'join', BadSeq2())
1232 self.checkequal('+hello+', '+%s+', '__mod__', 'hello')
1233 self.checkequal('+10+', '+%d+', '__mod__', 10)
1234 self.checkequal('a', "%c", '__mod__', "a")
1235 self.checkequal('a', "%c", '__mod__', "a")
1236 self.checkequal('"', "%c", '__mod__', 34)
1237 self.checkequal('$', "%c", '__mod__', 36)
1238 self.checkequal('10', "%d", '__mod__', 10)
1239 self.checkequal('\x7f', "%c", '__mod__', 0x7f)
1247 self.checkequal(' 42', '%3ld', '__mod__', 42)
1248 self.checkequal('42', '%d', '__mod__', 42.0)
1249 self.checkequal(slongvalue, '%d', '__mod__', longvalue)
1251 self.checkequal('0042.00', '%07.2f', '__mod__', 42)
1252 self.checkequal('0042.00', '%07.2F', '__mod__', 42)
1264 self.checkequal('bar', '%((foo))s', '__mod__', {'(foo)': 'bar'})
1267 self.checkequal(103*'a'+'x', '%sx', '__mod__', 103*'a')
1309 self.checkequal('a', 'A', 'lower')
1310 self.checkequal(True, 'A', 'isupper')
1311 self.checkequal('A', 'a', 'upper')
1312 self.checkequal(True, 'a', 'islower')
1314 self.checkequal('a', 'A', 'replace', 'A', 'a')
1315 self.checkequal(True, 'A', 'isupper')
1317 self.checkequal('A', 'a', 'capitalize')
1318 self.checkequal(True, 'a', 'islower')
1320 self.checkequal('A', 'a', 'swapcase')
1321 self.checkequal(True, 'a', 'islower')
1323 self.checkequal('A', 'a', 'title')
1324 self.checkequal(True, 'a', 'islower')
1328 self.checkequal(('this is the par', 'ti', 'tion method'),
1333 self.checkequal(('http', '://', 'www.python.org'), S, 'partition', '://')
1334 self.checkequal(('http://www.python.org', '', ''), S, 'partition', '?')
1335 self.checkequal(('', 'http://', 'www.python.org'), S, 'partition', 'http://')
1336 self.checkequal(('http://www.python.', 'org', ''), S, 'partition', 'org')
1343 self.checkequal(('this is the rparti', 'ti', 'on method'),
1348 self.checkequal(('http', '://', 'www.python.org'), S, 'rpartition', '://')
1349 self.checkequal(('', '', 'http://www.python.org'), S, 'rpartition', '?')
1350 self.checkequal(('', 'http://', 'www.python.org'), S, 'rpartition', 'http://')
1351 self.checkequal(('http://www.python.', 'org', ''), S, 'rpartition', 'org')
1359 self.checkequal(2, s, 'find', 'l', None)
1360 self.checkequal(3, s, 'find', 'l', -2, None)
1361 self.checkequal(2, s, 'find', 'l', None, -2)
1362 self.checkequal(0, s, 'find', 'h', None, None)
1364 self.checkequal(3, s, 'rfind', 'l', None)
1365 self.checkequal(3, s, 'rfind', 'l', -2, None)
1366 self.checkequal(2, s, 'rfind', 'l', None, -2)
1367 self.checkequal(0, s, 'rfind', 'h', None, None)
1369 self.checkequal(2, s, 'index', 'l', None)
1370 self.checkequal(3, s, 'index', 'l', -2, None)
1371 self.checkequal(2, s, 'index', 'l', None, -2)
1372 self.checkequal(0, s, 'index', 'h', None, None)
1374 self.checkequal(3, s, 'rindex', 'l', None)
1375 self.checkequal(3, s, 'rindex', 'l', -2, None)
1376 self.checkequal(2, s, 'rindex', 'l', None, -2)
1377 self.checkequal(0, s, 'rindex', 'h', None, None)
1379 self.checkequal(2, s, 'count', 'l', None)
1380 self.checkequal(1, s, 'count', 'l', -2, None)
1381 self.checkequal(1, s, 'count', 'l', None, -2)
1382 self.checkequal(0, s, 'count', 'x', None, None)
1384 self.checkequal(True, s, 'endswith', 'o', None)
1385 self.checkequal(True, s, 'endswith', 'lo', -2, None)
1386 self.checkequal(True, s, 'endswith', 'l', None, -2)
1387 self.checkequal(False, s, 'endswith', 'x', None, None)
1389 self.checkequal(True, s, 'startswith', 'h', None)
1390 self.checkequal(True, s, 'startswith', 'l', -2, None)
1391 self.checkequal(True, s, 'startswith', 'h', None, -2)
1392 self.checkequal(False, s, 'startswith', 'x', None, None)
1414 self.checkequal(10, "...\u043c......<", "find", "<")