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

Method test_bug691291

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

Source from the content-addressed store, hash-verified

711 "spamspam", self.spambe)
712
713 def test_bug691291(self):
714 # If encoding is not None, then
715 # files are always opened in binary mode, even if no binary mode was
716 # specified. This means that no automatic conversion of '\n' is done
717 # on reading and writing.
718 s1 = 'Hello\r\nworld\r\n'
719
720 s = s1.encode(self.encoding)
721 self.addCleanup(os_helper.unlink, os_helper.TESTFN)
722 with open(os_helper.TESTFN, 'wb') as fp:
723 fp.write(s)
724 with codecs_open_no_warn(os_helper.TESTFN, 'r',
725 encoding=self.encoding) as reader:
726 self.assertEqual(reader.read(), s1)
727
728 def test_invalid_modes(self):
729 for mode in ('U', 'rU', 'r+U'):

Callers

nothing calls this directly

Calls 7

codecs_open_no_warnFunction · 0.85
addCleanupMethod · 0.80
openFunction · 0.50
encodeMethod · 0.45
writeMethod · 0.45
assertEqualMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected