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

Method test_only_one_bom

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

Source from the content-addressed store, hash-verified

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

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