aboutsummaryrefslogtreecommitdiff
path: root/python/google/protobuf/internal/proto_builder_test.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/google/protobuf/internal/proto_builder_test.py')
-rw-r--r--python/google/protobuf/internal/proto_builder_test.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/python/google/protobuf/internal/proto_builder_test.py b/python/google/protobuf/internal/proto_builder_test.py
index edaf3fa3..1eda10fb 100644
--- a/python/google/protobuf/internal/proto_builder_test.py
+++ b/python/google/protobuf/internal/proto_builder_test.py
@@ -32,8 +32,15 @@
"""Tests for google.protobuf.proto_builder."""
-import collections
-import unittest
+try:
+ from collections import OrderedDict
+except ImportError:
+ from ordereddict import OrderedDict #PY26
+
+try:
+ import unittest2 as unittest #PY26
+except ImportError:
+ import unittest
from google.protobuf import descriptor_pb2
from google.protobuf import descriptor_pool
@@ -44,7 +51,7 @@ from google.protobuf import text_format
class ProtoBuilderTest(unittest.TestCase):
def setUp(self):
- self.ordered_fields = collections.OrderedDict([
+ self.ordered_fields = OrderedDict([
('foo', descriptor_pb2.FieldDescriptorProto.TYPE_INT64),
('bar', descriptor_pb2.FieldDescriptorProto.TYPE_STRING),
])