MCPcopy Create free account
hub / github.com/ipython/ipython / _FakeInput

Class _FakeInput

IPython/core/tests/test_debugger.py:30–43  ·  view source on GitHub ↗

A fake input stream for pdb's interactive debugger. Whenever a line is read, print it (to simulate the user typing it), and then return it. The set of lines to return is specified in the constructor; they should not have trailing newlines.

Source from the content-addressed store, hash-verified

28#-----------------------------------------------------------------------------
29
30class _FakeInput(object):
31 """
32 A fake input stream for pdb's interactive debugger. Whenever a
33 line is read, print it (to simulate the user typing it), and then
34 return it. The set of lines to return is specified in the
35 constructor; they should not have trailing newlines.
36 """
37 def __init__(self, lines):
38 self.lines = iter(lines)
39
40 def readline(self):
41 line = next(self.lines)
42 print(line)
43 return line+'\n'
44
45class PdbTestInput(object):
46 """Context manager that makes testing Pdb in doctests easier."""

Callers 1

__enter__Method · 0.85

Calls

no outgoing calls

Tested by 1

__enter__Method · 0.68