コード例 #1
0
    def test_correct_replacement_email_url(self):

        strs = [
            u'<br mlid="4" tid="4" /><div mlid="5" tid="5" ><div class="notranslate url">https://www.fedex.com/apps/fedextrack/?action=track&amp;ascend_header=1&amp;clienttype=dotcom&amp;cntry_code=us&amp;language=english&amp;tracknumbers=592005324745</div> </div><br mlid="6" tid="7" /><br mlid="7" tid="8" />Kind regards, <br mlid="8" tid="9" />Eyefi Customer Care<br mlid="9" tid="10" /><br mlid="10" tid="11" />',
            u'<div mlid="4" tid="4" >You can search for your profile using our account recovery tool: </div><div mlid="5" tid="6" ><div class="notranslate url">https://www.pinterest.com/password/reset/</div></div>).',
            u"We've put together a selection of guides to help you through this process: https://www.change.org/guides and http://petitionguide.org/ Best wishes, Yassine Change.org Help Center",
            u'<br mlid="4" tid="4" /><br mlid="5" tid="5" />We\'ve put together a selection of guides to help you through this process: <br mlid="6" tid="6" /><br mlid="7" tid="7" /><div mlid="8" tid="8" ><div class="notranslate url">https://www.change.org/guides</div> </div><br mlid="9" tid="10" /><br mlid="10" tid="11" />and <br mlid="11" tid="12" /><br mlid="12" tid="13" /><div mlid="13" tid="14" ><div class="notranslate url">http://petitionguide.org/</div> </div><br mlid="14" tid="16" /><br mlid="15" tid="17" />Best wishes, <br mlid="16" tid="18" /><br mlid="17" tid="19" />Yassine <br mlid="18" tid="20" /><div class="notranslate url">Change.org</div> Help Center<br mlid="19" tid="21" /><br mlid="20" tid="22" />'
            u'The email on the account is <div mlid="0" tid="0" ><div class="notranslate email">[email protected]</div></div>.'
            u'<img mlid="0" tid="0"/><div mlid="1" tid="1">el aprendizaje en <div class="notranslate gloss">Acogimiento Familiar\r</div>  <br mlid="2" tid="2"/><br mlid="3" tid="3"/>Abla El-Badry de <div mlid="4" tid="4">Hope Village Society</div>(Egipto): </div><br mlid="5" tid="7"/>Con la ayuda de un micro-donaci\xf3n de la familia, en agosto asist\xed al Congreso FICE en Viena, Austria, el <div mlid="6" tid="8">"Juntos hacia un mundo mejor para <div class="notranslate gloss">Ni\xf1os\r</div>, Adolescentes y <div class="notranslate gloss">Familias\r</div>". </div><br mlid="7" tid="10"/><br mlid="8" tid="11"/>A <div class="notranslate gloss">hope village society (hvs)\r</div> estamos abogando por un cambio en el egipcio <div class="notranslate gloss">acogimiento familiar\r</div> sistema, por lo que la conferencia fue una oportunidad muy importante para m\xed escuchar acerca de los retos y enfoques para <div class="notranslate gloss">acogimiento familiar\r</div> en 60 pa\xedses.',
        ]

        for i, st in enumerate(strs):
            with self.subTest(i=i):
                dummy_dict, it = create_dummy_str_email_url(st)
                final_s = replace_email_url(dummy_dict, it)

                self.assertEquals(st, final_s,
                                  "\nWanted:%s\nGot:%s\n" % (st, final_s))
コード例 #2
0
    def test_correct_replacement_utf8(self):
        strs = [
             u'\U0001f601 ^pd',
             u'\U0001f389 ^pd',
             u'\U0001f601 ^kr',
             u'\U0001f60a  ^pd',
             u'\U0001f60d  Cheers!',
             u'\U0001f64c ^pd',
             u'\U0001f601 Thanks for using Canva. \U0001f499 ^kr',
             u'\U0001f60d ^pd',
             u'\U0001f496^pd',
             u'\U0001f604 #SMMdayIT',
             u'\U0001f60dCheers!',
             u'\U0001f64c  ^pd',
             u'\U0001f4da ^pd',
             u'\U0001f609 ^pd',
             u'\U0001f49a ^pd',
             u'\U0001f44d ^pd',
             u'\U0001f618 ^pd',
             u'\U0001f601  Thank you for using <div class="notranslate gloss">Canva</div>!',
             u'\U0001f44f ^pd',
             u'\U0001f63b ^pd',
             u'\U0001f44f  Hope to see more designs from you soon!',
             u'\U0001f603 Cheers!',
             u'\U0001f496 ^pd',
             u'\U0001f60e ^pd',
             u'\U0001f609 Thanks for sharing your design with us!',
             u"\U0001f60a It's wonderful.",
             u'\U0001f44d Thanks for sharing this design with us!',
             u'\U0001f44d  Thanks for using <div class="notranslate gloss">Canva</div>!',
             u"\U0001f389 If you encounter any other issues or errors along the way, please don't hesitate to let us know.",
             u'\U0001f601  Thanks for using Canva!',
             u'\U0001f609 Thanks for sharing this, Jessica. \U0001f604 ^kr',
             u'\U0001f604 Thanks for using <div class="notranslate gloss">Canva</div>.',
             u'\U0001f62e ^pd',
             u'\U0001f44f Thank you for sharing it with us!',
             u'\U0001f60d ^pd',
             u'Thank you for sharing this fun design with us.\U0001f60d ^pd',
             u'\U0001f4f7 ^pd',
             u'\U0001f64c ^pd',
             u'Your <div class="notranslate gloss">infograf\xeda</div> looks amazing.\U0001f604 ^kr',
             u'\U0001f60e',
             u'\U0001f609Kidding. \U0001f499 ^kr',
             u'\U0001f609 Cheers ^eb',
             u'\U0001f60d Thanks for using <div class="notranslate gloss">Canva</div> to make this!',
             u'\U0001f334 ^pd',
             u'\U0001f49c Cheers!',
             u'\U0001f601 ^pd',
             u'\U0001f603 ^pd',
             u'\U0001f60d ^pd',
             u'\U0001f496 ^pd',
             u'\U0001f44f\U0001f3fb ^pd',
             u'\U0001f60d Thanks for using <div class="notranslate gloss">Canva</div>!',
             u'\U0001f499 ^kr',
             u'\U0001f618 ^kr',
             u'\U0001f609 Thanks for sharing your <div class="notranslate gloss">Canva</div> design.',
             u'\U0001f44d\U0001f44d ^kr',
             u'\U0001f609 ^kr',
             u'Hope you enjoyed designing as much as we enjoyed seeing your work!\U0001f60a ^gl',
             u'Excited to see more of your work.\U0001f60a ^gl',
             u'Lovely <div class="notranslate gloss">presentaci\xf3n</div> design, Daniela!\U0001f33a ^gl',
             u'Falling in love with your design, Ximena.\U0001f60d Thank you for creating with <div class="notranslate gloss">Canva</div>.',
             u'Thanks for sharing.\U0001f60a ^gl',
             u'We try to respond to as much languages as we can, Claudia.\U0001f609',
             u'\U0001f495 ^kr',
             u'\U0001f60a ^kr',
             u'\U0001f60a^gl',
             u'\U0001f61d Thanks for sharing!',
             u'\U0001f60a ^gl',
             u'Happy graduation!\U0001f393 ^gl',
             u'\U0001f60b Thanks for sharing your design with us!',
             u'~\U0001f499 ^kr',
             u'Hope you did!\U0001f60a ^gl',
             u'\U0001f604 ^kr'
                ]
        for i, st in enumerate(strs):
            with self.subTest(i=i):
                dummy_dict, it = create_dummy_str_email_url(st)
                final_s = replace_email_url(dummy_dict, it)

                self.assertEquals(st, final_s,
                                  "\nWanted:%s\nGot:%s\n" % (st, final_s))