(self)
| 467 | b'\x00\x00\x00s\x00\x00\x00p\x00\x00\x00a\x00\x00\x00m') |
| 468 | |
| 469 | def test_only_one_bom(self): |
| 470 | _,_,reader,writer = codecs.lookup(self.encoding) |
| 471 | # encode some stream |
| 472 | s = io.BytesIO() |
| 473 | f = writer(s) |
| 474 | f.write("spam") |
| 475 | f.write("spam") |
| 476 | d = s.getvalue() |
| 477 | # check whether there is exactly one BOM in it |
| 478 | self.assertTrue(d == self.spamle or d == self.spambe) |
| 479 | # try to read it back |
| 480 | s = io.BytesIO(d) |
| 481 | f = reader(s) |
| 482 | self.assertEqual(f.read(), "spamspam") |
| 483 | |
| 484 | def test_badbom(self): |
| 485 | s = io.BytesIO(4*b"\xff") |
nothing calls this directly
no test coverage detected