• Home
  • Raw
  • Download

Lines Matching full:replace

152                     r2, rem = divmod(n - len(i.replace(j, self.fixtype(''))),
542 EQ("", "", "replace", "", "")
543 EQ("A", "", "replace", "", "A")
544 EQ("", "", "replace", "A", "")
545 EQ("", "", "replace", "A", "A")
546 EQ("", "", "replace", "", "", 100)
547 EQ("A", "", "replace", "", "A", 100)
548 EQ("", "", "replace", "", "", sys.maxsize)
551 EQ("A", "A", "replace", "", "")
552 EQ("*A*", "A", "replace", "", "*")
553 EQ("*1A*1", "A", "replace", "", "*1")
554 EQ("*-#A*-#", "A", "replace", "", "*-#")
555 EQ("*-A*-A*-", "AA", "replace", "", "*-")
556 EQ("*-A*-A*-", "AA", "replace", "", "*-", -1)
557 EQ("*-A*-A*-", "AA", "replace", "", "*-", sys.maxsize)
558 EQ("*-A*-A*-", "AA", "replace", "", "*-", 4)
559 EQ("*-A*-A*-", "AA", "replace", "", "*-", 3)
560 EQ("*-A*-A", "AA", "replace", "", "*-", 2)
561 EQ("*-AA", "AA", "replace", "", "*-", 1)
562 EQ("AA", "AA", "replace", "", "*-", 0)
565 EQ("", "A", "replace", "A", "")
566 EQ("", "AAA", "replace", "A", "")
567 EQ("", "AAA", "replace", "A", "", -1)
568 EQ("", "AAA", "replace", "A", "", sys.maxsize)
569 EQ("", "AAA", "replace", "A", "", 4)
570 EQ("", "AAA", "replace", "A", "", 3)
571 EQ("A", "AAA", "replace", "A", "", 2)
572 EQ("AA", "AAA", "replace", "A", "", 1)
573 EQ("AAA", "AAA", "replace", "A", "", 0)
574 EQ("", "AAAAAAAAAA", "replace", "A", "")
575 EQ("BCD", "ABACADA", "replace", "A", "")
576 EQ("BCD", "ABACADA", "replace", "A", "", -1)
577 EQ("BCD", "ABACADA", "replace", "A", "", sys.maxsize)
578 EQ("BCD", "ABACADA", "replace", "A", "", 5)
579 EQ("BCD", "ABACADA", "replace", "A", "", 4)
580 EQ("BCDA", "ABACADA", "replace", "A", "", 3)
581 EQ("BCADA", "ABACADA", "replace", "A", "", 2)
582 EQ("BACADA", "ABACADA", "replace", "A", "", 1)
583 EQ("ABACADA", "ABACADA", "replace", "A", "", 0)
584 EQ("BCD", "ABCAD", "replace", "A", "")
585 EQ("BCD", "ABCADAA", "replace", "A", "")
586 EQ("BCD", "BCD", "replace", "A", "")
587 EQ("*************", "*************", "replace", "A", "")
588 EQ("^A^", "^"+"A"*1000+"^", "replace", "A", "", 999)
591 EQ("", "the", "replace", "the", "")
592 EQ("ater", "theater", "replace", "the", "")
593 EQ("", "thethe", "replace", "the", "")
594 EQ("", "thethethethe", "replace", "the", "")
595 EQ("aaaa", "theatheatheathea", "replace", "the", "")
596 EQ("that", "that", "replace", "the", "")
597 EQ("thaet", "thaet", "replace", "the", "")
598 EQ("here and re", "here and there", "replace", "the", "")
600 "replace", "the", "", sys.maxsize)
602 "replace", "the", "", -1)
604 "replace", "the", "", 3)
606 "replace", "the", "", 2)
608 "replace", "the", "", 1)
610 "replace", "the", "", 0)
611 EQ("here and re and re", "here and there and there", "replace", "the", "")
613 EQ("abc", "abc", "replace", "the", "")
614 EQ("abcdefg", "abcdefg", "replace", "the", "")
617 EQ("bob", "bbobob", "replace", "bob", "")
618 EQ("bobXbob", "bbobobXbbobob", "replace", "bob", "")
619 EQ("aaaaaaa", "aaaaaaabob", "replace", "bob", "")
620 EQ("aaaaaaa", "aaaaaaa", "replace", "bob", "")
622 # single character replace in place (len(from)==len(to)==1)
623 EQ("Who goes there?", "Who goes there?", "replace", "o", "o")
624 EQ("WhO gOes there?", "Who goes there?", "replace", "o", "O")
625 EQ("WhO gOes there?", "Who goes there?", "replace", "o", "O", sys.maxsize)
626 EQ("WhO gOes there?", "Who goes there?", "replace", "o", "O", -1)
627 EQ("WhO gOes there?", "Who goes there?", "replace", "o", "O", 3)
628 EQ("WhO gOes there?", "Who goes there?", "replace", "o", "O", 2)
629 EQ("WhO goes there?", "Who goes there?", "replace", "o", "O", 1)
630 EQ("Who goes there?", "Who goes there?", "replace", "o", "O", 0)
632 EQ("Who goes there?", "Who goes there?", "replace", "a", "q")
633 EQ("who goes there?", "Who goes there?", "replace", "W", "w")
634 EQ("wwho goes there?ww", "WWho goes there?WW", "replace", "W", "w")
635 EQ("Who goes there!", "Who goes there?", "replace", "?", "!")
636 EQ("Who goes there!!", "Who goes there??", "replace", "?", "!")
638 EQ("Who goes there?", "Who goes there?", "replace", ".", "!")
640 # substring replace in place (len(from)==len(to) > 1)
641 EQ("Th** ** a t**sue", "This is a tissue", "replace", "is", "**")
642 EQ("Th** ** a t**sue", "This is a tissue", "replace", "is", "**", sys.maxsize)
643 EQ("Th** ** a t**sue", "This is a tissue", "replace", "is", "**", -1)
644 EQ("Th** ** a t**sue", "This is a tissue", "replace", "is", "**", 4)
645 EQ("Th** ** a t**sue", "This is a tissue", "replace", "is", "**", 3)
646 EQ("Th** ** a tissue", "This is a tissue", "replace", "is", "**", 2)
647 EQ("Th** is a tissue", "This is a tissue", "replace", "is", "**", 1)
648 EQ("This is a tissue", "This is a tissue", "replace", "is", "**", 0)
649 EQ("cobob", "bobob", "replace", "bob", "cob")
650 EQ("cobobXcobocob", "bobobXbobobob", "replace", "bob", "cob")
651 EQ("bobob", "bobob", "replace", "bot", "bot")
653 # replace single character (len(from)==1, len(to)>1)
654 EQ("ReyKKjaviKK", "Reykjavik", "replace", "k", "KK")
655 EQ("ReyKKjaviKK", "Reykjavik", "replace", "k", "KK", -1)
656 EQ("ReyKKjaviKK", "Reykjavik", "replace", "k", "KK", sys.maxsize)
657 EQ("ReyKKjaviKK", "Reykjavik", "replace", "k", "KK", 2)
658 EQ("ReyKKjavik", "Reykjavik", "replace", "k", "KK", 1)
659 EQ("Reykjavik", "Reykjavik", "replace", "k", "KK", 0)
660 EQ("A----B----C----", "A.B.C.", "replace", ".", "----")
662 EQ('...\u043c......&lt;', '...\u043c......<', "replace", "<", "&lt;")
664 EQ("Reykjavik", "Reykjavik", "replace", "q", "KK")
666 # replace substring (len(from)>1, len(to)!=len(from))
668 "replace", "spam", "ham")
670 "replace", "spam", "ham", sys.maxsize)
672 "replace", "spam", "ham", -1)
674 "replace", "spam", "ham", 4)
676 "replace", "spam", "ham", 3)
678 "replace", "spam", "ham", 2)
680 "replace", "spam", "ham", 1)
682 "replace", "spam", "ham", 0)
684 EQ("bobob", "bobobob", "replace", "bobob", "bob")
685 EQ("bobobXbobob", "bobobobXbobobob", "replace", "bobob", "bob")
686 EQ("BOBOBOB", "BOBOBOB", "replace", "bob", "bobby")
688 self.checkequal('one@two!three!', 'one!two!three!', 'replace', '!', '@', 1)
689 self.checkequal('onetwothree', 'one!two!three!', 'replace', '!', '')
690 self.checkequal('one@two@three!', 'one!two!three!', 'replace', '!', '@', 2)
691 self.checkequal('one@two@three@', 'one!two!three!', 'replace', '!', '@', 3)
692 self.checkequal('one@two@three@', 'one!two!three!', 'replace', '!', '@', 4)
693 self.checkequal('one!two!three!', 'one!two!three!', 'replace', '!', '@', 0)
694 self.checkequal('one@two@three@', 'one!two!three!', 'replace', '!', '@')
695 self.checkequal('one!two!three!', 'one!two!three!', 'replace', 'x', '@')
696 self.checkequal('one!two!three!', 'one!two!three!', 'replace', 'x', '@', 2)
697 self.checkequal('-a-b-c-', 'abc', 'replace', '', '-')
698 self.checkequal('-a-b-c', 'abc', 'replace', '', '-', 3)
699 self.checkequal('abc', 'abc', 'replace', '', '-', 0)
700 self.checkequal('', '', 'replace', '', '')
701 self.checkequal('abc', 'abc', 'replace', 'ab', '--', 0)
702 self.checkequal('abc', 'abc', 'replace', 'xy', '--')
703 # Next three for SF bug 422088: [OSF1 alpha] string.replace(); died with
706 self.checkequal('', '123', 'replace', '123', '')
707 self.checkequal('', '123123', 'replace', '123', '')
708 self.checkequal('x', '123x123', 'replace', '123', '')
710 self.checkraises(TypeError, 'hello', 'replace')
711 self.checkraises(TypeError, 'hello', 'replace', 42)
712 self.checkraises(TypeError, 'hello', 'replace', 42, 'h')
713 self.checkraises(TypeError, 'hello', 'replace', 'h', 42)
720 self.checkraises(OverflowError, A2_16, "replace", "", A2_16)
721 self.checkraises(OverflowError, A2_16, "replace", "A", A2_16)
722 self.checkraises(OverflowError, A2_16, "replace", "AA", A2_16+A2_16)
1353 self.checkequal('a', 'A', 'replace', 'A', 'a')