diff --git a/lldb/third_party/Python/module/unittest2/unittest2/case.py b/lldb/third_party/Python/module/unittest2/unittest2/case.py index 485cef09c22c..68a9a7a42d15 100644 --- a/lldb/third_party/Python/module/unittest2/unittest2/case.py +++ b/lldb/third_party/Python/module/unittest2/unittest2/case.py @@ -7,6 +7,8 @@ import re import unittest import warnings +import six + from unittest2 import result from unittest2.util import ( safe_repr, safe_str, strclass, @@ -137,7 +139,7 @@ class _AssertRaisesContext(object): return True expected_regexp = self.expected_regexp - if isinstance(expected_regexp, basestring): + if isinstance(expected_regexp, six.string_types): expected_regexp = re.compile(expected_regexp) if not expected_regexp.search(str(exc_value)): raise self.failureException('"%s" does not match "%s"' % @@ -156,7 +158,7 @@ class _TypeEqualityDict(object): def __getitem__(self, key): value = self._store[key] - if isinstance(value, basestring): + if isinstance(value, six.string_types): return getattr(self.testcase, value) return value @@ -940,9 +942,9 @@ class TestCase(unittest.TestCase): def assertMultiLineEqual(self, first, second, msg=None): """Assert that two multi-line strings are equal.""" - self.assert_(isinstance(first, basestring), ( + self.assert_(isinstance(first, six.string_types), ( 'First argument is not a string')) - self.assert_(isinstance(second, basestring), ( + self.assert_(isinstance(second, six.string_types), ( 'Second argument is not a string')) if first != second: @@ -1018,7 +1020,7 @@ class TestCase(unittest.TestCase): try: callable_obj(*args, **kwargs) except expected_exception as exc_value: - if isinstance(expected_regexp, basestring): + if isinstance(expected_regexp, six.string_types): expected_regexp = re.compile(expected_regexp) if not expected_regexp.search(str(exc_value)): raise self.failureException('"%s" does not match "%s"' % @@ -1033,7 +1035,7 @@ class TestCase(unittest.TestCase): def assertRegexpMatches(self, text, expected_regexp, msg=None): """Fail the test unless the text matches the regular expression.""" - if isinstance(expected_regexp, basestring): + if isinstance(expected_regexp, six.string_types): expected_regexp = re.compile(expected_regexp) if not expected_regexp.search(text): msg = msg or "Regexp didn't match" @@ -1042,7 +1044,7 @@ class TestCase(unittest.TestCase): def assertNotRegexpMatches(self, text, unexpected_regexp, msg=None): """Fail the test if the text matches the regular expression.""" - if isinstance(unexpected_regexp, basestring): + if isinstance(unexpected_regexp, six.string_types): unexpected_regexp = re.compile(unexpected_regexp) match = unexpected_regexp.search(text) if match: diff --git a/lldb/third_party/Python/module/unittest2/unittest2/main.py b/lldb/third_party/Python/module/unittest2/unittest2/main.py index c0b71ef6b831..d74b01f9ac23 100644 --- a/lldb/third_party/Python/module/unittest2/unittest2/main.py +++ b/lldb/third_party/Python/module/unittest2/unittest2/main.py @@ -3,6 +3,7 @@ import sys import os import types +import six from unittest2 import loader, runner try: @@ -76,7 +77,7 @@ class TestProgram(object): argv=None, testRunner=None, testLoader=loader.defaultTestLoader, exit=True, verbosity=1, failfast=None, catchbreak=None, buffer=None): - if isinstance(module, basestring): + if isinstance(module, six.string_types): self.module = __import__(module) for part in module.split('.')[1:]: self.module = getattr(self.module, part) diff --git a/lldb/third_party/Python/module/unittest2/unittest2/suite.py b/lldb/third_party/Python/module/unittest2/unittest2/suite.py index da97f5bf8d25..9fda66aa09e5 100644 --- a/lldb/third_party/Python/module/unittest2/unittest2/suite.py +++ b/lldb/third_party/Python/module/unittest2/unittest2/suite.py @@ -3,6 +3,7 @@ import sys import unittest from unittest2 import case, util +import six __unittest = True @@ -48,7 +49,7 @@ class BaseTestSuite(unittest.TestSuite): self._tests.append(test) def addTests(self, tests): - if isinstance(tests, basestring): + if isinstance(tests, six.string_types): raise TypeError("tests must be an iterable of tests, not a string") for test in tests: self.addTest(test) diff --git a/lldb/third_party/Python/module/unittest2/unittest2/test/test_case.py b/lldb/third_party/Python/module/unittest2/unittest2/test/test_case.py index 2e670d7b2cf6..5f310ecb046e 100644 --- a/lldb/third_party/Python/module/unittest2/unittest2/test/test_case.py +++ b/lldb/third_party/Python/module/unittest2/unittest2/test/test_case.py @@ -1,6 +1,7 @@ import difflib import pprint import re +import six from copy import deepcopy @@ -502,7 +503,7 @@ class Test_TestCase(unittest2.TestCase, EqualityMixin, HashingMixin): def runTest(self): pass - self.assertIsInstance(Foo().id(), basestring) + self.assertIsInstance(Foo().id(), six.string_types) # "If result is omitted or None, a temporary result object is created # and used, but is not made available to the caller. As TestCase owns the diff --git a/lldb/third_party/Python/module/unittest2/unittest2/test/test_functiontestcase.py b/lldb/third_party/Python/module/unittest2/unittest2/test/test_functiontestcase.py index 295aec37fdc3..263aed5a9bf6 100644 --- a/lldb/third_party/Python/module/unittest2/unittest2/test/test_functiontestcase.py +++ b/lldb/third_party/Python/module/unittest2/unittest2/test/test_functiontestcase.py @@ -1,4 +1,5 @@ import unittest2 +import six from unittest2.test.support import LoggingResult @@ -124,7 +125,7 @@ class Test_FunctionTestCase(unittest2.TestCase): def test_id(self): test = unittest2.FunctionTestCase(lambda: None) - self.assertIsInstance(test.id(), basestring) + self.assertIsInstance(test.id(), six.string_types) # "Returns a one-line description of the test, or None if no description # has been provided. The default implementation of this method returns