diff options
author | Walter Dörwald <walter@livinglogic.de> | 2005-02-04 14:15:34 (GMT) |
---|---|---|
committer | Walter Dörwald <walter@livinglogic.de> | 2005-02-04 14:15:34 (GMT) |
commit | 1f1d252f516968df8310835c388ad7323c513134 (patch) | |
tree | 0f1eb39ea8ed2def0a05ee1f0f6cb77bf26b24da | |
parent | 07561b3b8e35553ebdbf2cab3afc52378c0e50ff (diff) | |
download | cpython-1f1d252f516968df8310835c388ad7323c513134.zip cpython-1f1d252f516968df8310835c388ad7323c513134.tar.gz cpython-1f1d252f516968df8310835c388ad7323c513134.tar.bz2 |
Add a test for UTF-16 reading where the byte sequence doesn't start with
a BOM.
-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 dbe9b88..5abc785 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", |