(self)
| 651 | spambe = b'\xfe\xff\x00s\x00p\x00a\x00m\x00s\x00p\x00a\x00m' |
| 652 | |
| 653 | def test_only_one_bom(self): |
| 654 | _,_,reader,writer = codecs.lookup(self.encoding) |
| 655 | # encode some stream |
| 656 | s = io.BytesIO() |
| 657 | f = writer(s) |
| 658 | f.write("spam") |
| 659 | f.write("spam") |
| 660 | d = s.getvalue() |
| 661 | # check whether there is exactly one BOM in it |
| 662 | self.assertTrue(d == self.spamle or d == self.spambe) |
| 663 | # try to read it back |
| 664 | s = io.BytesIO(d) |
| 665 | f = reader(s) |
| 666 | self.assertEqual(f.read(), "spamspam") |
| 667 | |
| 668 | def test_badbom(self): |
| 669 | s = io.BytesIO(b"\xff\xff") |
nothing calls this directly
no test coverage detected