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

Method test_writelines

tests/test_misc.py:155–163  ·  view source on GitHub ↗

spawn.writelines()

(self)

Source from the content-addressed store, hash-verified

153 self.assertEqual(child.readline(), b'a\r\n')
154
155 def test_writelines(self):
156 " spawn.writelines() "
157 child = pexpect.spawn('cat')
158 # notice that much like file.writelines, we do not delimit by newline
159 # -- it is equivalent to calling write(''.join([args,]))
160 child.writelines(['abc', '123', 'xyz', '\r'])
161 child.sendeof()
162 line = child.readline()
163 assert line == b'abc123xyz\r\n'
164
165 def test_eof(self):
166 " call to expect() after EOF is received raises pexpect.EOF "

Callers

nothing calls this directly

Calls 4

readlineMethod · 0.80
spawnMethod · 0.45
writelinesMethod · 0.45
sendeofMethod · 0.45

Tested by

no test coverage detected