MCPcopy Index your code
hub / github.com/python/cpython / test_only_one_bom

Method test_only_one_bom

Lib/test/test_codecs.py:653–666  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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")

Callers

nothing calls this directly

Calls 7

getvalueMethod · 0.95
readerFunction · 0.85
assertTrueMethod · 0.80
lookupMethod · 0.45
writeMethod · 0.45
assertEqualMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected