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

Method test_multiline_auto_indent

Lib/test/test_pdb.py:5103–5121  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

5101 @unittest.skipIf(sys.platform.startswith('freebsd'),
5102 '\\x08 is not interpreted as backspace on FreeBSD')
5103 def test_multiline_auto_indent(self):
5104 script = textwrap.dedent("""
5105 import pdb; pdb.Pdb().set_trace()
5106 """)
5107
5108 input = b"def f(x):\n"
5109 input += b"if x > 0:\n"
5110 input += b"x += 1\n"
5111 input += b"return x\n"
5112 # We need to do backspaces to remove the auto-indentation
5113 input += b"\x08\x08\x08\x08else:\n"
5114 input += b"return -x\n"
5115 input += b"\n"
5116 input += b"f(-21-21)\n"
5117 input += b"c\n"
5118
5119 output = run_pty(script, input)
5120
5121 self.assertIn(b'42', output)
5122
5123 def test_multiline_completion(self):
5124 script = textwrap.dedent("""

Callers

nothing calls this directly

Calls 3

run_ptyFunction · 0.90
assertInMethod · 0.80
dedentMethod · 0.45

Tested by

no test coverage detected