1 import test_support
,unittest
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")
13 s
= StringIO
.StringIO()
18 # check whether there is exactly one BOM in it
19 self
.assert_(d
== self
.spamle
or d
== self
.spambe
)
21 s
= StringIO
.StringIO(d
)
23 self
.assertEquals(f
.read(), u
"spamspam")
27 test_support
.run_unittest(UTF16Test
)
30 if __name__
== "__main__":