on xenial help sign in
Change check for str/basestring
commit8811130ce742f53acf6473575f0148be6817b136 authorChristopher Lee <chris.lee@canonical.com> dateThu 14 Nov 2013, 17:33 (13 years ago) parent03a5787
1 file changed+9−3
tests/autopilot/unity8/shell/tests/test_lock_screen.py+9−3
tests/autopilot/unity8/shell/tests/test_lock_screen.py+9−3
@@ -25,12 +25,18 @@ from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
2525
2626from autopilot.matchers import Eventually
2727from autopilot.platform import model
28+import sys
2829from testtools import skipUnless
2930from testtools.matchers import Equals
3031import logging
3132
3233logger = logging.getLogger(__name__)
3334
35+# py2 compatible alias for py3
36+if sys.version >= '3':
37+ basestring = str
38+
39+
3440class TestLockscreen(UnityTestCase):
3541
3642 """Tests for the lock screen."""
@@ -123,7 +129,7 @@ class TestLockscreen(UnityTestCase):
123129
124130 """
125131
126− if not isinstance(code, str):
132+ if not isinstance(code, basestring):
127133 raise TypeError(
128134 "'code' parameter must be a string, not %r."
129135 % type(passphrase)
@@ -143,7 +149,7 @@ class TestLockscreen(UnityTestCase):
143149 :raises: TypeError if passphrase is not a string.
144150
145151 """
146− if not isinstance(passphrase, str):
152+ if not isinstance(passphrase, basestring):
147153 raise TypeError(
148154 "'passphrase' parameter must be a string, not %r."
149155 % type(passphrase)
@@ -165,7 +171,7 @@ class TestLockscreen(UnityTestCase):
165171 :raises: TypeError if passphrase is not a string.
166172
167173 """
168− if not isinstance(passphrase, str):
174+ if not isinstance(passphrase, basestring):
169175 raise TypeError(
170176 "'passphrase' parameter must be a string, not %r."
171177 % type(passphrase)