aboutsummaryrefslogtreecommitdiffhomepage
path: root/python/google/protobuf/internal/message_factory_test.py
diff options
context:
space:
mode:
authorGravatar Jisi Liu <jisi.liu@gmail.com>2017-10-18 12:22:18 -0700
committerGravatar Jisi Liu <jisi.liu@gmail.com>2017-10-18 12:22:18 -0700
commit1a7a7fca804afa1cf67f8be5e71092898ba40334 (patch)
tree04b3da27c71c607510f34a12cf7856a1b94181ae /python/google/protobuf/internal/message_factory_test.py
parentc4f59dcc5c13debc572154c8f636b8a9361aacde (diff)
Merge from google internal
Diffstat (limited to 'python/google/protobuf/internal/message_factory_test.py')
-rw-r--r--python/google/protobuf/internal/message_factory_test.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/python/google/protobuf/internal/message_factory_test.py b/python/google/protobuf/internal/message_factory_test.py
index a1b6bb81..6df52ed2 100644
--- a/python/google/protobuf/internal/message_factory_test.py
+++ b/python/google/protobuf/internal/message_factory_test.py
@@ -107,8 +107,17 @@ class MessageFactoryTest(unittest.TestCase):
def testGetMessages(self):
# performed twice because multiple calls with the same input must be allowed
for _ in range(2):
- messages = message_factory.GetMessages([self.factory_test1_fd,
- self.factory_test2_fd])
+ # GetMessage should work regardless of the order the FileDescriptorProto
+ # are provided. In particular, the function should succeed when the files
+ # are not in the topological order of dependencies.
+
+ # Assuming factory_test2_fd depends on factory_test1_fd.
+ self.assertIn(self.factory_test1_fd.name,
+ self.factory_test2_fd.dependency)
+ # Get messages should work when a file comes before its dependencies:
+ # factory_test2_fd comes before factory_test1_fd.
+ messages = message_factory.GetMessages([self.factory_test2_fd,
+ self.factory_test1_fd])
self.assertTrue(
set(['google.protobuf.python.internal.Factory2Message',
'google.protobuf.python.internal.Factory1Message'],