Fix the availability statement for the spawn*() functions to reflect the
[python/dscho.git] / Lib / test / test_codecs.py
blob28d84ce4a63c7e5a233fa8f7735727bf434e93aa
1 import test_support,unittest
2 import codecs
3 import StringIO
5 class UTF16Test(unittest.TestCase):
7 spamle = '\xff\xfes\x00p\x00a\x00m\x00s\x00p\x00a\x00m\x00'
8 spambe = '\xfe\xff\x00s\x00p\x00a\x00m\x00s\x00p\x00a\x00m'
10 def test_only_one_bom(self):
11 _,_,reader,writer = codecs.lookup("utf-16")
12 # encode some stream
13 s = StringIO.StringIO()
14 f = writer(s)
15 f.write(u"spam")
16 f.write(u"spam")
17 d = s.getvalue()
18 # check whether there is exactly one BOM in it
19 self.assert_(d == self.spamle or d == self.spambe)
20 # try to read it back
21 s = StringIO.StringIO(d)
22 f = reader(s)
23 self.assertEquals(f.read(), u"spamspam")
26 def test_main():
27 test_support.run_unittest(UTF16Test)
30 if __name__ == "__main__":
31 test_main()