summaryrefslogtreecommitdiff
path: root/tests/test_expect.py
diff options
context:
space:
mode:
authorjquast <contact@jeffquast.com>2013-09-22 21:55:36 -0700
committerjquast <contact@jeffquast.com>2013-09-22 21:55:36 -0700
commit8e2e7ba23ee747f7589cbf2007a09f9cfc7f63c7 (patch)
treea7a1c973f329d61011b6d6aa48dfe9378e5a9eb7 /tests/test_expect.py
parente1cb3cb9563764a8a4e8bbdb51c99da095068e4f (diff)
downloadpexpect-8e2e7ba23ee747f7589cbf2007a09f9cfc7f63c7.tar.gz
fix old/new way for sure ...
Diffstat (limited to 'tests/test_expect.py')
-rwxr-xr-xtests/test_expect.py21
1 files changed, 14 insertions, 7 deletions
diff --git a/tests/test_expect.py b/tests/test_expect.py
index 9a98e51..85edfaa 100755
--- a/tests/test_expect.py
+++ b/tests/test_expect.py
@@ -308,9 +308,9 @@ class ExpectTestCase (PexpectTestCase.PexpectTestCase):
break
the_new_way = the_new_way.rstrip()
the_new_way = the_new_way.replace(six.b('\r\n'), six.b('\n')
- ).replace(six.b('\r'), six.b('\n')).replace('\n\n', '\n').rstrip()
+ ).replace(six.b('\r'), six.b('\n')).replace(six.b('\n\n'), six.b('\n')).rstrip()
the_old_way = the_old_way.replace(six.b('\r\n'), six.b('\n')
- ).replace(six.b('\r'), six.b('\n')).replace('\n\n', '\n').rstrip()
+ ).replace(six.b('\r'), six.b('\n')).replace(six.b('\n\n'), six.b('\n')).rstrip()
assert the_old_way == the_new_way, hex_diff(the_old_way, the_new_way)
def test_expect_exact (self):
@@ -324,9 +324,9 @@ class ExpectTestCase (PexpectTestCase.PexpectTestCase):
if i == 1:
break
the_new_way = the_new_way.replace(six.b('\r\n'), six.b('\n')
- ).replace(six.b('\r'), six.b('\n')).replace('\n\n', '\n').rstrip()
+ ).replace(six.b('\r'), six.b('\n')).replace(six.b('\n\n'), six.b('\n')).rstrip()
the_old_way = the_old_way.replace(six.b('\r\n'), six.b('\n')
- ).replace(six.b('\r'), six.b('\n')).replace('\n\n', '\n').rstrip()
+ ).replace(six.b('\r'), six.b('\n')).replace(six.b('\n\n'), six.b('\n')).rstrip()
assert the_old_way == the_new_way, hex_diff(the_old_way, the_new_way)
p = pexpect.spawn('echo hello.?world')
i = p.expect_exact(six.b('.?'))
@@ -340,9 +340,9 @@ class ExpectTestCase (PexpectTestCase.PexpectTestCase):
p.expect(pexpect.EOF) # This basically tells it to read everything. Same as pexpect.run() function.
the_new_way = p.before
the_new_way = the_new_way.replace(six.b('\r\n'), six.b('\n')
- ).replace(six.b('\r'), six.b('\n')).replace('\n\n', '\n').rstrip()
+ ).replace(six.b('\r'), six.b('\n')).replace(six.b('\n\n'), six.b('\n')).rstrip()
the_old_way = the_old_way.replace(six.b('\r\n'), six.b('\n')
- ).replace(six.b('\r'), six.b('\n')).replace('\n\n', '\n').rstrip()
+ ).replace(six.b('\r'), six.b('\n')).replace(six.b('\n\n'), six.b('\n')).rstrip()
assert the_old_way == the_new_way, hex_diff(the_old_way, the_new_way)
def test_expect_timeout (self):
@@ -483,7 +483,7 @@ class ExpectTestCase (PexpectTestCase.PexpectTestCase):
p.expect(six.b('>>> '))
try:
- p.expect(12345)
+ p.expect([1,'2','3','4','5'])
assert False, 'TypeError should have been raised'
except TypeError:
err = sys.exc_info()[1]
@@ -492,6 +492,13 @@ class ExpectTestCase (PexpectTestCase.PexpectTestCase):
assert err.message.startswith(e_msg), err.message
else:
assert str(err).startswith(e_msg), err
+ except AttributeError:
+ err = sys.exc_info()[1]
+ e_msg = "'int' object has no attribute 'encode'"
+ if hasattr(err, 'message'):
+ assert err.message.startswith(e_msg), err.message
+ else:
+ assert str(err).startswith(e_msg), err
def test_greed(self):
p = pexpect.spawn(self.PYTHONBIN)