From 26603a14666c0f30883bc4508591522586ba51f8 Mon Sep 17 00:00:00 2001 From: Thomas Hisch Date: Sat, 30 Oct 2021 20:56:40 +0200 Subject: [PATCH] Remove unittest2 imports (#9171) They were only needed for python versions <= 2.6 Related: #6658 --- python/google/protobuf/internal/_parameterized.py | 5 +---- python/google/protobuf/internal/generator_test.py | 5 +---- python/google/protobuf/internal/proto_builder_test.py | 5 +---- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/python/google/protobuf/internal/_parameterized.py b/python/google/protobuf/internal/_parameterized.py index 2229671ed6..deafab324e 100755 --- a/python/google/protobuf/internal/_parameterized.py +++ b/python/google/protobuf/internal/_parameterized.py @@ -148,10 +148,7 @@ __author__ = 'tmarek@google.com (Torsten Marek)' import functools import re import types -try: - import unittest2 as unittest -except ImportError: - import unittest +import unittest import uuid try: diff --git a/python/google/protobuf/internal/generator_test.py b/python/google/protobuf/internal/generator_test.py index 0c4299a3d1..9883fce31e 100644 --- a/python/google/protobuf/internal/generator_test.py +++ b/python/google/protobuf/internal/generator_test.py @@ -39,10 +39,7 @@ further ensures that we can use Python protocol message objects as we expect. __author__ = 'robinson@google.com (Will Robinson)' -try: - import unittest2 as unittest #PY26 -except ImportError: - import unittest +import unittest from google.protobuf.internal import test_bad_identifiers_pb2 from google.protobuf import unittest_custom_options_pb2 diff --git a/python/google/protobuf/internal/proto_builder_test.py b/python/google/protobuf/internal/proto_builder_test.py index 8e2afaf98c..48077b0a4b 100644 --- a/python/google/protobuf/internal/proto_builder_test.py +++ b/python/google/protobuf/internal/proto_builder_test.py @@ -31,10 +31,7 @@ """Tests for google.protobuf.proto_builder.""" import collections -try: - import unittest2 as unittest -except ImportError: - import unittest +import unittest from google.protobuf import descriptor_pb2 # pylint: disable=g-import-not-at-top from google.protobuf import descriptor