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

Method test_readlines

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

Source from the content-addressed store, hash-verified

185 self.assertRaises(TypeError, f.readlines, 1, 1)
186
187 def test_readlines(self):
188 shell = MockShell()
189 f = run.StdInputFile(shell, 'stdin')
190 shell.push(['one\n', 'two\n', ''])
191 self.assertEqual(f.readlines(), ['one\n', 'two\n'])
192 shell.push(['one\n', 'two\n', ''])
193 self.assertEqual(f.readlines(-1), ['one\n', 'two\n'])
194 shell.push(['one\n', 'two\n', ''])
195 self.assertEqual(f.readlines(None), ['one\n', 'two\n'])
196 shell.push(['one\n', 'two\n', ''])
197 self.assertEqual(f.readlines(0), ['one\n', 'two\n'])
198 shell.push(['one\n', 'two\n', ''])
199 self.assertEqual(f.readlines(3), ['one\n'])
200 shell.push(['one\n', 'two\n', ''])
201 self.assertEqual(f.readlines(4), ['one\n', 'two\n'])
202
203 shell.push(['one\n', 'two\n', ''])
204 self.assertRaises(TypeError, f.readlines, 1.5)
205 self.assertRaises(TypeError, f.readlines, '1')
206 self.assertRaises(TypeError, f.readlines, 1, 1)
207
208 def test_close(self):
209 shell = MockShell()

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected