diff options
Diffstat (limited to 'python/google/protobuf/internal/_parameterized.py')
-rwxr-xr-x | python/google/protobuf/internal/_parameterized.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/python/google/protobuf/internal/_parameterized.py b/python/google/protobuf/internal/_parameterized.py index 400b2216..3002b230 100755 --- a/python/google/protobuf/internal/_parameterized.py +++ b/python/google/protobuf/internal/_parameterized.py @@ -152,6 +152,8 @@ import types import unittest import uuid +import six + ADDR_RE = re.compile(r'\<([a-zA-Z0-9_\-\.]+) object at 0x[a-fA-F0-9]+\>') _SEPARATOR = uuid.uuid1().hex _FIRST_ARG = object() @@ -170,13 +172,13 @@ def _StrClass(cls): def _NonStringIterable(obj): return (isinstance(obj, collections.Iterable) and not - isinstance(obj, basestring)) + isinstance(obj, six.string_types)) def _FormatParameterList(testcase_params): if isinstance(testcase_params, collections.Mapping): return ', '.join('%s=%s' % (argname, _CleanRepr(value)) - for argname, value in testcase_params.iteritems()) + for argname, value in testcase_params.items()) elif _NonStringIterable(testcase_params): return ', '.join(map(_CleanRepr, testcase_params)) else: @@ -258,7 +260,7 @@ def _ModifyClass(class_object, testcases, naming_type): 'Cannot add parameters to %s,' ' which already has parameterized methods.' % (class_object,)) class_object._id_suffix = id_suffix = {} - for name, obj in class_object.__dict__.items(): + for name, obj in class_object.__dict__.copy().items(): if (name.startswith(unittest.TestLoader.testMethodPrefix) and isinstance(obj, types.FunctionType)): delattr(class_object, name) @@ -266,7 +268,7 @@ def _ModifyClass(class_object, testcases, naming_type): _UpdateClassDictForParamTestCase( methods, id_suffix, name, _ParameterizedTestIter(obj, testcases, naming_type)) - for name, meth in methods.iteritems(): + for name, meth in methods.items(): setattr(class_object, name, meth) |