diff options
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/test_misc.py | 6 | ||||
-rw-r--r-- | tests/test_popen_spawn.py | 8 |
2 files changed, 14 insertions, 0 deletions
diff --git a/tests/test_misc.py b/tests/test_misc.py index 118de2e..6052b6a 100755 --- a/tests/test_misc.py +++ b/tests/test_misc.py @@ -87,6 +87,12 @@ class TestCaseMisc(PexpectTestCase.PexpectTestCase): remaining = child.read().replace(_CAT_EOF, b'') self.assertEqual(remaining, b'abc\r\n') + def test_read_poll_timeout(self): + " Test use_poll properly times out " + child = pexpect.spawn('sleep 5', use_poll=True) + with self.assertRaises(pexpect.TIMEOUT): + child.expect(pexpect.EOF, timeout=1) + def test_readline_bin_echo(self): " Test spawn('echo'). " # given, diff --git a/tests/test_popen_spawn.py b/tests/test_popen_spawn.py index 98046ed..fca7493 100644 --- a/tests/test_popen_spawn.py +++ b/tests/test_popen_spawn.py @@ -125,6 +125,14 @@ class ExpectTestCase (PexpectTestCase.PexpectTestCase): p.expect_exact('def') p.expect(pexpect.EOF) + def test_crlf(self): + p = PopenSpawn('echo alpha beta') + assert p.read() == b'alpha beta' + p.crlf + + def test_crlf_encoding(self): + p = PopenSpawn('echo alpha beta', encoding='utf-8') + assert p.read() == 'alpha beta' + p.crlf + if __name__ == '__main__': unittest.main() |