diff options
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/test_expect.py | 8 | ||||
-rwxr-xr-x | tests/test_performance.py | 6 |
2 files changed, 14 insertions, 0 deletions
diff --git a/tests/test_expect.py b/tests/test_expect.py index dcf059b..ec55d43 100755 --- a/tests/test_expect.py +++ b/tests/test_expect.py @@ -400,6 +400,14 @@ class ExpectTestCase (PexpectTestCase.PexpectTestCase): else: self.fail ('Expected an EOF exception.') + def test_buffer_interface(self): + p = pexpect.spawn('cat', timeout=5) + p.sendline (b'Hello') + p.expect (b'Hello') + assert len(p.buffer) + p.buffer = b'Testing' + p.sendeof () + def _before_after(self, p): p.timeout = 5 diff --git a/tests/test_performance.py b/tests/test_performance.py index 7be0cf6..63778af 100755 --- a/tests/test_performance.py +++ b/tests/test_performance.py @@ -23,6 +23,7 @@ from __future__ import print_function import unittest, time, sys import platform import pexpect +import re from . import PexpectTestCase # This isn't exactly a unit test, but it fits in nicely with the rest of the tests. @@ -101,6 +102,11 @@ class PerformanceTestCase (PexpectTestCase.PexpectTestCase): self.faster_range(100000) print("100000 calls to faster_range:", (time.time() - start_time)) + def test_large_stdout_stream(self): + e = pexpect.spawn('openssl rand -base64 {}'.format(1024*1024*25), searchwindowsize=1000) + resp = e.expect(['Password:', pexpect.EOF, pexpect.TIMEOUT]) + assert resp == 1 # index 1 == EOF + if __name__ == "__main__": unittest.main() |