예제 #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))
예제 #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))
예제 #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))
예제 #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))