MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_only_one_bom

Method test_only_one_bom

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected