| from test import test_support |
| class UTF16Test(unittest.TestCase): |
| spamle = '\xff\xfes\x00p\x00a\x00m\x00s\x00p\x00a\x00m\x00' |
| spambe = '\xfe\xff\x00s\x00p\x00a\x00m\x00s\x00p\x00a\x00m' |
| def test_only_one_bom(self): |
| _,_,reader,writer = codecs.lookup("utf-16") |
| # check whether there is exactly one BOM in it |
| self.assert_(d == self.spamle or d == self.spambe) |
| self.assertEquals(f.read(), u"spamspam") |
| class EscapeDecodeTest(unittest.TestCase): |
| def test_empty_escape_decode(self): |
| self.assertEquals(codecs.escape_decode(""), ("", 0)) |
| suite = unittest.TestSuite() |
| suite.addTest(unittest.makeSuite(UTF16Test)) |
| suite.addTest(unittest.makeSuite(EscapeDecodeTest)) |
| test_support.run_suite(suite) |
| if __name__ == "__main__": |