diff options
Diffstat (limited to 'Lib/test/test_codecs.py')
-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", |