diff options
author | Dan O'Reilly <oreilldf@gmail.com> | 2015-08-14 22:54:53 -0400 |
---|---|---|
committer | Dan O'Reilly <oreilldf@gmail.com> | 2015-08-14 22:54:53 -0400 |
commit | 2621c8aefbfefd517a3facc6dc0e0dc45ae5eb87 (patch) | |
tree | a12a81028a9ac3b4aab2cfbbfc495e1da82c5669 /python/google/protobuf/internal/descriptor_test.py | |
parent | d06adbd4a48c83aa8e9085e988020ad3bff43211 (diff) |
Get Python 2.6 working.
Signed-off-by: Dan O'Reilly <oreilldf@gmail.com>
Diffstat (limited to 'python/google/protobuf/internal/descriptor_test.py')
-rwxr-xr-x | python/google/protobuf/internal/descriptor_test.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/python/google/protobuf/internal/descriptor_test.py b/python/google/protobuf/internal/descriptor_test.py index a40ec0e4..34843a61 100755 --- a/python/google/protobuf/internal/descriptor_test.py +++ b/python/google/protobuf/internal/descriptor_test.py @@ -36,7 +36,6 @@ __author__ = 'robinson@google.com (Will Robinson)' import sys -import unittest from google.protobuf import unittest_custom_options_pb2 from google.protobuf import unittest_import_pb2 from google.protobuf import unittest_pb2 @@ -46,6 +45,11 @@ from google.protobuf import descriptor from google.protobuf import symbol_database from google.protobuf import text_format +try: + import unittest2 as unittest +except ImportError: + import unittest + TEST_EMPTY_MESSAGE_DESCRIPTOR_ASCII = """ name: 'TestEmptyMessage' @@ -455,7 +459,7 @@ class GeneratedDescriptorTest(unittest.TestCase): # properties of an immutable abc.Mapping. self.assertGreater(len(mapping), 0) # Sized self.assertEqual(len(mapping), len(list(mapping))) # Iterable - if sys.version_info.major >= 3: + if sys.version_info >= (3,): key, item = next(iter(mapping.items())) else: key, item = mapping.items()[0] @@ -464,7 +468,7 @@ class GeneratedDescriptorTest(unittest.TestCase): # keys(), iterkeys() &co item = (next(iter(mapping.keys())), next(iter(mapping.values()))) self.assertEqual(item, next(iter(mapping.items()))) - if sys.version_info.major < 3: + if sys.version_info < (3,): def CheckItems(seq, iterator): self.assertEqual(next(iterator), seq[0]) self.assertEqual(list(iterator), seq[1:]) |