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

Method test_rawio

Lib/test/test_io/test_textio.py:1003–1012  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1001 txt.buffer = buf
1002
1003 def test_rawio(self):
1004 # Issue #12591: TextIOWrapper must work with raw I/O objects, so
1005 # that subprocess.Popen() can have the required unbuffered
1006 # semantics with universal_newlines=True.
1007 raw = self.MockRawIO([b'abc', b'def', b'ghi\njkl\nopq\n'])
1008 txt = self.TextIOWrapper(raw, encoding='ascii', newline='\n')
1009 # Reads
1010 self.assertEqual(txt.read(4), 'abcd')
1011 self.assertEqual(txt.readline(), 'efghi\n')
1012 self.assertEqual(list(txt), ['jkl\n', 'opq\n'])
1013
1014 def test_rawio_write_through(self):
1015 # 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