summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtests/test_expect.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/test_expect.py b/tests/test_expect.py
index 2c74744..2232e37 100755
--- a/tests/test_expect.py
+++ b/tests/test_expect.py
@@ -25,11 +25,14 @@ import time
import signal
import sys
import os
+import re
import pexpect
from . import PexpectTestCase
from .utils import no_coverage_env
+PY3 = bool(sys.version_info.major >= 3)
+
# Many of these test cases blindly assume that sequential directory
# listings of the /bin directory will yield the same results.
# This may not be true, but seems adequate for testing now.
@@ -101,6 +104,23 @@ class ExpectTestCase (PexpectTestCase.PexpectTestCase):
p.sendeof ()
p.expect (pexpect.EOF)
+ def _select_types(self, encoding=None):
+ if encoding is None:
+ if PY3:
+ expect_string = 'String'
+ expected_type = bytes
+ else:
+ expect_string = u'String'
+ expected_type = str
+ else:
+ if PY3:
+ expect_string = b'String'
+ expected_type = str
+ else:
+ expect_string = 'String'
+ expected_type = unicode
+ return re.compile(expect_string), expected_type
+
def test_expect_order (self):
'''This tests that patterns are matched in the same order as given in the pattern_list.