Пример #1
0
    def test_htmlencoding_nonentities(self):
        """tests to give us full coverage"""
        for encoded, real in [(u"Some &; text", u"Some &; text"),
                              (u"&copy ", u"&copy "),
                              (u"&copy", u"&copy"),
                              (u"&rogerrabbit;", u"&rogerrabbit;"),]:
            assert quote.htmlentitydecode(encoded) == real

        for decoded, real in [(u"Some &; text", u"Some &; text"),
                              (u"&copy ", u"&copy "),
                              (u"&copy", u"&copy"),
                              (u"&rogerrabbit;", u"&rogerrabbit;"),]:
            assert quote.htmlentityencode(decoded) == real
Пример #2
0
    def test_htmlencoding_nonentities():
        """tests to give us full coverage"""
        for encoded, real in [
            ("Some &; text", "Some &; text"),
            ("&copy ", "&copy "),
            ("&copy", "&copy"),
            ("&rogerrabbit;", "&rogerrabbit;"),
        ]:
            assert quote.htmlentitydecode(encoded) == real

        for decoded, real in [
            ("Some &; text", "Some &; text"),
            ("&copy ", "&copy "),
            ("&copy", "&copy"),
            ("&rogerrabbit;", "&rogerrabbit;"),
        ]:
            assert quote.htmlentityencode(decoded) == real
Пример #3
0
 def test_htmlencoding_existing_entities():
     """test that we don't mess existing entities"""
     assert quote.htmlentityencode("&") == "&"
Пример #4
0
 def _html_encoding_helper(pairs):
     for from_, to in pairs:
         assert quote.htmlentityencode(from_) == to
         assert quote.htmlentitydecode(to) == from_
Пример #5
0
 def _html_encoding_helper(self, pairs):
     for from_, to in pairs:
         assert quote.htmlentityencode(from_) == to
         assert quote.htmlentitydecode(to) == from_
Пример #6
0
 def test_htmlencoding_existing_entities(self):
     """test that we don't mess existing entities"""
     assert quote.htmlentityencode(u"&") == u"&"
Пример #7
0
 def test_htmlencoding(self):
     """test that we can encode and decode HTML entities"""
     raw_encoded = [(u"€", "€"), (u"©", "©"), (u'"', """)]
     for raw, encoded in raw_encoded:
         assert quote.htmlentityencode(raw) == encoded
         assert quote.htmlentitydecode(encoded) == raw
Пример #8
0
 def test_htmlencoding(self):
     """test that we can encode and decode HTML entities"""
     raw_encoded = [(u"€", "€"), (u"©", "©"), (u'"', """)]
     for raw, encoded in raw_encoded:
         assert quote.htmlentityencode(raw) == encoded
         assert quote.htmlentitydecode(encoded) == raw