diff options
author | Walter Dörwald <walter@livinglogic.de> | 2005-02-04 14:15:34 +0000 |
---|---|---|
committer | Walter Dörwald <walter@livinglogic.de> | 2005-02-04 14:15:34 +0000 |
commit | 67b71c0f7deb16b061eb6501244cba855258e6bd (patch) | |
tree | d37d1d55fc2843b5022c4f55ba1bf7c18f1d4034 /Lib | |
parent | 156005b6fba91a02f7596733a64f07a6f04a8998 (diff) | |
download | cpython-67b71c0f7deb16b061eb6501244cba855258e6bd.tar.gz |
Add a test for UTF-16 reading where the byte sequence doesn't start with
a BOM.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_codecs.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_codecs.py b/Lib/test/test_codecs.py index dbe9b88dbd..5abc785657 100644 --- a/Lib/test/test_codecs.py +++ b/Lib/test/test_codecs.py @@ -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", |