MCPcopy Create free account
hub / github.com/pexpect/pexpect / test_multiline

Method test_multiline

tests/test_replwrap.py:72–87  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

70 self.assertEqual(res.strip().splitlines(), ['begin', 'done'])
71
72 def test_multiline(self):
73 bash = replwrap.bash()
74 res = bash.run_command("echo '1 2\n3 4'")
75 self.assertEqual(res.strip().splitlines(), ['1 2', '3 4'])
76
77 # Should raise ValueError if input is incomplete
78 try:
79 bash.run_command("echo '5 6")
80 except ValueError:
81 pass
82 else:
83 assert False, "Didn't raise ValueError for incomplete input"
84
85 # Check that the REPL was reset (SIGINT) after the incomplete input
86 res = bash.run_command("echo '1 2\n3 4'")
87 self.assertEqual(res.strip().splitlines(), ['1 2', '3 4'])
88
89 def test_existing_spawn(self):
90 child = pexpect.spawn("bash", timeout=5, encoding='utf-8')

Callers

nothing calls this directly

Calls 1

run_commandMethod · 0.80

Tested by

no test coverage detected