| Index: third_party/protobuf/python/google/protobuf/internal/generator_test.py
|
| diff --git a/third_party/protobuf/python/google/protobuf/internal/generator_test.py b/third_party/protobuf/python/google/protobuf/internal/generator_test.py
|
| index 5c07cbe6b17f8dabf9ee2f53011a49e1059b9b21..8343aba1e176efe22f016eb92913b9dcad52d565 100755
|
| --- a/third_party/protobuf/python/google/protobuf/internal/generator_test.py
|
| +++ b/third_party/protobuf/python/google/protobuf/internal/generator_test.py
|
| @@ -1,8 +1,8 @@
|
| -#! /usr/bin/env python
|
| +#! /usr/bin/python
|
| #
|
| # Protocol Buffers - Google's data interchange format
|
| # Copyright 2008 Google Inc. All rights reserved.
|
| -# https://developers.google.com/protocol-buffers/
|
| +# http://code.google.com/p/protobuf/
|
| #
|
| # Redistribution and use in source and binary forms, with or without
|
| # modification, are permitted provided that the following conditions are
|
| @@ -35,7 +35,7 @@
|
| # indirect testing of the protocol compiler output.
|
|
|
| """Unittest that directly tests the output of the pure-Python protocol
|
| -compiler. See //google/protobuf/internal/reflection_test.py for a test which
|
| +compiler. See //google/protobuf/reflection_test.py for a test which
|
| further ensures that we can use Python protocol message objects as we expect.
|
| """
|
|
|
| @@ -47,10 +47,9 @@ from google.protobuf import unittest_custom_options_pb2
|
| from google.protobuf import unittest_import_pb2
|
| from google.protobuf import unittest_import_public_pb2
|
| from google.protobuf import unittest_mset_pb2
|
| -from google.protobuf import unittest_no_generic_services_pb2
|
| from google.protobuf import unittest_pb2
|
| +from google.protobuf import unittest_no_generic_services_pb2
|
| from google.protobuf import service
|
| -from google.protobuf import symbol_database
|
|
|
| MAX_EXTENSION = 536870912
|
|
|
| @@ -149,7 +148,7 @@ class GeneratorTest(unittest.TestCase):
|
| proto = unittest_custom_options_pb2.TestMessageWithCustomOptions()
|
| enum_options = proto.DESCRIPTOR.enum_types_by_name['AnEnum'].GetOptions()
|
| self.assertTrue(enum_options is not None)
|
| - # TODO(gps): We really should test for the presence of the enum_opt1
|
| + # TODO(gps): We really should test for the presense of the enum_opt1
|
| # extension and for its value to be set to -789.
|
|
|
| def testNestedTypes(self):
|
| @@ -218,10 +217,6 @@ class GeneratorTest(unittest.TestCase):
|
| 'google/protobuf/unittest.proto')
|
| self.assertEqual(unittest_pb2.DESCRIPTOR.package, 'protobuf_unittest')
|
| self.assertFalse(unittest_pb2.DESCRIPTOR.serialized_pb is None)
|
| - self.assertEqual(unittest_pb2.DESCRIPTOR.dependencies,
|
| - [unittest_import_pb2.DESCRIPTOR])
|
| - self.assertEqual(unittest_import_pb2.DESCRIPTOR.dependencies,
|
| - [unittest_import_public_pb2.DESCRIPTOR])
|
|
|
| def testNoGenericServices(self):
|
| self.assertTrue(hasattr(unittest_no_generic_services_pb2, "TestMessage"))
|
| @@ -246,18 +241,6 @@ class GeneratorTest(unittest.TestCase):
|
| unittest_pb2._TESTALLTYPES_NESTEDMESSAGE.name in
|
| file_type.message_types_by_name)
|
|
|
| - def testEnumTypesByName(self):
|
| - file_type = unittest_pb2.DESCRIPTOR
|
| - self.assertEqual(
|
| - unittest_pb2._FOREIGNENUM,
|
| - file_type.enum_types_by_name[unittest_pb2._FOREIGNENUM.name])
|
| -
|
| - def testExtensionsByName(self):
|
| - file_type = unittest_pb2.DESCRIPTOR
|
| - self.assertEqual(
|
| - unittest_pb2.my_extension_string,
|
| - file_type.extensions_by_name[unittest_pb2.my_extension_string.name])
|
| -
|
| def testPublicImports(self):
|
| # Test public imports as embedded message.
|
| all_type_proto = unittest_pb2.TestAllTypes()
|
| @@ -282,62 +265,5 @@ class GeneratorTest(unittest.TestCase):
|
| self.assertEqual(message.Extensions[test_bad_identifiers_pb2.service],
|
| "qux")
|
|
|
| - def testOneof(self):
|
| - desc = unittest_pb2.TestAllTypes.DESCRIPTOR
|
| - self.assertEqual(1, len(desc.oneofs))
|
| - self.assertEqual('oneof_field', desc.oneofs[0].name)
|
| - self.assertEqual(0, desc.oneofs[0].index)
|
| - self.assertIs(desc, desc.oneofs[0].containing_type)
|
| - self.assertIs(desc.oneofs[0], desc.oneofs_by_name['oneof_field'])
|
| - nested_names = set(['oneof_uint32', 'oneof_nested_message',
|
| - 'oneof_string', 'oneof_bytes'])
|
| - self.assertItemsEqual(
|
| - nested_names,
|
| - [field.name for field in desc.oneofs[0].fields])
|
| - for field_name, field_desc in desc.fields_by_name.iteritems():
|
| - if field_name in nested_names:
|
| - self.assertIs(desc.oneofs[0], field_desc.containing_oneof)
|
| - else:
|
| - self.assertIsNone(field_desc.containing_oneof)
|
| -
|
| -
|
| -class SymbolDatabaseRegistrationTest(unittest.TestCase):
|
| - """Checks that messages, enums and files are correctly registered."""
|
| -
|
| - def testGetSymbol(self):
|
| - self.assertEquals(
|
| - unittest_pb2.TestAllTypes, symbol_database.Default().GetSymbol(
|
| - 'protobuf_unittest.TestAllTypes'))
|
| - self.assertEquals(
|
| - unittest_pb2.TestAllTypes.NestedMessage,
|
| - symbol_database.Default().GetSymbol(
|
| - 'protobuf_unittest.TestAllTypes.NestedMessage'))
|
| - with self.assertRaises(KeyError):
|
| - symbol_database.Default().GetSymbol('protobuf_unittest.NestedMessage')
|
| - self.assertEquals(
|
| - unittest_pb2.TestAllTypes.OptionalGroup,
|
| - symbol_database.Default().GetSymbol(
|
| - 'protobuf_unittest.TestAllTypes.OptionalGroup'))
|
| - self.assertEquals(
|
| - unittest_pb2.TestAllTypes.RepeatedGroup,
|
| - symbol_database.Default().GetSymbol(
|
| - 'protobuf_unittest.TestAllTypes.RepeatedGroup'))
|
| -
|
| - def testEnums(self):
|
| - self.assertEquals(
|
| - 'protobuf_unittest.ForeignEnum',
|
| - symbol_database.Default().pool.FindEnumTypeByName(
|
| - 'protobuf_unittest.ForeignEnum').full_name)
|
| - self.assertEquals(
|
| - 'protobuf_unittest.TestAllTypes.NestedEnum',
|
| - symbol_database.Default().pool.FindEnumTypeByName(
|
| - 'protobuf_unittest.TestAllTypes.NestedEnum').full_name)
|
| -
|
| - def testFindFileByName(self):
|
| - self.assertEquals(
|
| - 'google/protobuf/unittest.proto',
|
| - symbol_database.Default().pool.FindFileByName(
|
| - 'google/protobuf/unittest.proto').name)
|
| -
|
| if __name__ == '__main__':
|
| unittest.main()
|
|
|