'Test for invalid entity encoded chars'

def test_html_invalid_utf8_entity_encoded(self):

    samples = {'Valid    ASCII': u'a', 'Valid    2    Octet    Sequence': u'&#xc3b1', 'Invalid    2    Octet    Sequence': u'&#xc328', 'Invalid    Sequence    Identifier': u'&#xa0a1', 'Valid    3    Octet    Sequence': u'&#xe282a1', 'Invalid    3    Octet    Sequence    (in    2nd    Octet)': u'&#xe228a1', 'Invalid    3    Octet    Sequence    (in    3rd    Octet)': u'&#xe28228', 'Valid    4    Octet    Sequence': u'&#xf0908cbc', 'Invalid    4    Octet    Sequence    (in    2nd    Octet)': u'&#xf0288cbc', 'Invalid    4    Octet    Sequence    (in    3rd    Octet)': u'&#xf09028bc', 'Invalid    4    Octet    Sequence    (in    4th    Octet)': u'&#xf0288c28', 'Valid    5    Octet    Sequence    (but    not    Unicode!)': u'    &#xf8a1a1a1a1    ', 'Valid    6    Octet    Sequence    (but    not    Unicode!)': u'    &#xfca1a1a1a1a1    ', 'Invalid    unicode    FFFE': u'&#xFFFE', 'Invalid    unicode    FFFF': u'&#xFFFF'}
    for (desc, sample) in samples.iteritems():
        try:
            htmldecode(sample)
        except Exception as e:
            msg = 'Exception    "%s"    was    raised    when    trying    to    htmldecode()    a    "%s".'
            self.assertTrue(False, (msg % (e, desc)))
