Esempio n. 1
0
 def test(self, expected=expected, input=input):
     expected = ''.join([
         token.toxml() for token in
         html5parser.HTMLParser().parseFragment(expected).childNodes
     ])
     expected = simplejson.loads(simplejson.dumps(expected))
     self.assertEqual(expected, self.sanitize_html(input))
Esempio n. 2
0
 def test(self, expected=expected, input=input):
     expected = ''.join([token.toxml() for token in html5parser.HTMLParser().
       parseFragment(expected).childNodes])
     expected = simplejson.loads(simplejson.dumps(expected))
     self.assertEqual(expected, self.sanitize_html(input))
Esempio n. 3
0
def normalizeTokens(tokens):
    # TODO: convert tests to reflect arrays
    for i, token in enumerate(tokens):
        if token[0] == u'ParseError':
            tokens[i] = token[0]
    return simplejson.loads(simplejson.dumps(tokens))
Esempio n. 4
0
def normalizeTokens(tokens):
    # TODO: convert tests to reflect arrays
    for i, token in enumerate(tokens):
        if token[0] == u'ParseError':
            tokens[i] = token[0]
    return simplejson.loads(simplejson.dumps(tokens))
 def test(self, expected=expected, input=input):
     expected = simplejson.loads(simplejson.dumps(expected))
     self.assertEqual(expected, self.sanitize_html(input, strip=strip))