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

Method test_read

Lib/idlelib/idle_test/test_run.py:142–160  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

140 self.assertRaises(OSError, f.writelines, ['x'])
141
142 def test_read(self):
143 shell = MockShell()
144 f = run.StdInputFile(shell, 'stdin')
145 shell.push(['one\n', 'two\n', ''])
146 self.assertEqual(f.read(), 'one\ntwo\n')
147 shell.push(['one\n', 'two\n', ''])
148 self.assertEqual(f.read(-1), 'one\ntwo\n')
149 shell.push(['one\n', 'two\n', ''])
150 self.assertEqual(f.read(None), 'one\ntwo\n')
151 shell.push(['one\n', 'two\n', 'three\n', ''])
152 self.assertEqual(f.read(2), 'on')
153 self.assertEqual(f.read(3), 'e\nt')
154 self.assertEqual(f.read(10), 'wo\nthree\n')
155
156 shell.push(['one\n', 'two\n'])
157 self.assertEqual(f.read(0), '')
158 self.assertRaises(TypeError, f.read, 1.5)
159 self.assertRaises(TypeError, f.read, '1')
160 self.assertRaises(TypeError, f.read, 1, 1)
161
162 def test_readline(self):
163 shell = MockShell()

Callers

nothing calls this directly

Calls 5

pushMethod · 0.95
readMethod · 0.95
MockShellClass · 0.85
assertEqualMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected