Add a test for UTF-16 reading where the byte sequence doesn't start with
a BOM.
This commit is contained in:
parent
07561b3b8e
commit
1f1d252f51
|
@ -159,6 +159,15 @@ class UTF16Test(ReadTest):
|
|||
f = reader(s)
|
||||
self.assertEquals(f.read(), u"spamspam")
|
||||
|
||||
def test_badbom(self):
|
||||
s = StringIO.StringIO("\xff\xff")
|
||||
f = codecs.getwriter(self.encoding)(s)
|
||||
self.assertRaises(UnicodeError, f.read)
|
||||
|
||||
s = StringIO.StringIO("\xff\xff\xff\xff")
|
||||
f = codecs.getwriter(self.encoding)(s)
|
||||
self.assertRaises(UnicodeError, f.read)
|
||||
|
||||
def test_partial(self):
|
||||
self.check_partial(
|
||||
u"\x00\xff\u0100\uffff",
|
||||
|
|
Loading…
Reference in New Issue