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

Method test_rawio

Lib/test/test_io.py:3663–3672  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3661 txt.buffer = buf
3662
3663 def test_rawio(self):
3664 # Issue #12591: TextIOWrapper must work with raw I/O objects, so
3665 # that subprocess.Popen() can have the required unbuffered
3666 # semantics with universal_newlines=True.
3667 raw = self.MockRawIO([b'abc', b'def', b'ghi\njkl\nopq\n'])
3668 txt = self.TextIOWrapper(raw, encoding='ascii', newline='\n')
3669 # Reads
3670 self.assertEqual(txt.read(4), 'abcd')
3671 self.assertEqual(txt.readline(), 'efghi\n')
3672 self.assertEqual(list(txt), ['jkl\n', 'opq\n'])
3673
3674 def test_rawio_write_through(self):
3675 # Issue #12591: with write_through=True, writes don't need a flush

Callers

nothing calls this directly

Calls 4

readMethod · 0.95
readlineMethod · 0.95
listClass · 0.85
assertEqualMethod · 0.45

Tested by

no test coverage detected