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

Method test_only_one_bom

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

Source from the content-addressed store, hash-verified

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