Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(215)

Side by Side Diff: recipe_engine/third_party/google/protobuf/internal/reflection_test.py

Issue 2236673002: Bump vendoring, move to proto3 release. (Closed) Base URL: https://github.com/luci/recipes-py@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 #! /usr/bin/env python 1 #! /usr/bin/env python
2 # -*- coding: utf-8 -*- 2 # -*- coding: utf-8 -*-
3 # 3 #
4 # Protocol Buffers - Google's data interchange format 4 # Protocol Buffers - Google's data interchange format
5 # Copyright 2008 Google Inc. All rights reserved. 5 # Copyright 2008 Google Inc. All rights reserved.
6 # https://developers.google.com/protocol-buffers/ 6 # https://developers.google.com/protocol-buffers/
7 # 7 #
8 # Redistribution and use in source and binary forms, with or without 8 # Redistribution and use in source and binary forms, with or without
9 # modification, are permitted provided that the following conditions are 9 # modification, are permitted provided that the following conditions are
10 # met: 10 # met:
(...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after
965 965
966 # Test clearing. 966 # Test clearing.
967 proto.ClearField('repeated_nested_message') 967 proto.ClearField('repeated_nested_message')
968 self.assertTrue(not proto.repeated_nested_message) 968 self.assertTrue(not proto.repeated_nested_message)
969 self.assertEqual(0, len(proto.repeated_nested_message)) 969 self.assertEqual(0, len(proto.repeated_nested_message))
970 970
971 # Test constructing an element while adding it. 971 # Test constructing an element while adding it.
972 proto.repeated_nested_message.add(bb=23) 972 proto.repeated_nested_message.add(bb=23)
973 self.assertEqual(1, len(proto.repeated_nested_message)) 973 self.assertEqual(1, len(proto.repeated_nested_message))
974 self.assertEqual(23, proto.repeated_nested_message[0].bb) 974 self.assertEqual(23, proto.repeated_nested_message[0].bb)
975 self.assertRaises(TypeError, proto.repeated_nested_message.add, 23)
975 976
976 def testRepeatedCompositeRemove(self): 977 def testRepeatedCompositeRemove(self):
977 proto = unittest_pb2.TestAllTypes() 978 proto = unittest_pb2.TestAllTypes()
978 979
979 self.assertEqual(0, len(proto.repeated_nested_message)) 980 self.assertEqual(0, len(proto.repeated_nested_message))
980 m0 = proto.repeated_nested_message.add() 981 m0 = proto.repeated_nested_message.add()
981 # Need to set some differentiating variable so m0 != m1 != m2: 982 # Need to set some differentiating variable so m0 != m1 != m2:
982 m0.bb = len(proto.repeated_nested_message) 983 m0.bb = len(proto.repeated_nested_message)
983 m1 = proto.repeated_nested_message.add() 984 m1 = proto.repeated_nested_message.add()
984 m1.bb = len(proto.repeated_nested_message) 985 m1.bb = len(proto.repeated_nested_message)
(...skipping 1989 matching lines...) Expand 10 before | Expand all | Expand 10 after
2974 'bar {' 2975 'bar {'
2975 ' baz {' 2976 ' baz {'
2976 ' deep: 4' 2977 ' deep: 4'
2977 ' }' 2978 ' }'
2978 '}') 2979 '}')
2979 text_format.Merge(msg_str, msg) 2980 text_format.Merge(msg_str, msg)
2980 self.assertEqual(msg.bar.baz.deep, 4) 2981 self.assertEqual(msg.bar.baz.deep, 4)
2981 2982
2982 if __name__ == '__main__': 2983 if __name__ == '__main__':
2983 unittest.main() 2984 unittest.main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698