diff options
Diffstat (limited to 'tests/test_expect.py')
-rwxr-xr-x | tests/test_expect.py | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/tests/test_expect.py b/tests/test_expect.py index c62231a..8a8c595 100755 --- a/tests/test_expect.py +++ b/tests/test_expect.py @@ -441,7 +441,7 @@ class ExpectTestCase (PexpectTestCase.PexpectTestCase): ''' p = pexpect.spawn('%s -Wi list100.py' % self.PYTHONBIN, env=no_coverage_env()) self._before_after(p) - + def test_before_after_exact(self): '''This tests some simple before/after things, for expect_exact(). (Grahn broke it at one point.) @@ -451,6 +451,22 @@ class ExpectTestCase (PexpectTestCase.PexpectTestCase): p.expect = p.expect_exact self._before_after(p) + def test_before_after_timeout(self): + child = pexpect.spawn('cat', echo=False) + child.sendline('BEGIN') + for i in range(100): + child.sendline('foo' * 100) + e = child.expect(['xyzzy', pexpect.TIMEOUT], + searchwindowsize=10, timeout=0.001) + self.assertEqual(e, 1) + child.sendline('xyzzy') + e = child.expect(['xyzzy', pexpect.TIMEOUT], + searchwindowsize=10, timeout=30) + self.assertEqual(e, 0) + self.assertEqual(child.before[0:5], 'BEGIN') + child.sendeof() + child.expect(pexpect.EOF) + def _ordering(self, p): p.timeout = 20 p.expect(b'>>> ') |