Python google.protobuf.message.repeated_int32() Examples
The following are 30 code examples for showing how to use google.protobuf.message.repeated_int32(). These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example.
You may check out the related API usage on the sidebar.
You may also want to check out all available functions/classes of the module
google.protobuf.message
, or try the search function
.
Example 1
Project: lambda-packs Author: ryfeus File: message_test.py License: MIT License | 6 votes |
def testSortingRepeatedScalarFieldsCustomComparator(self, message_module): """Check some different types with custom comparator.""" message = message_module.TestAllTypes() message.repeated_int32.append(-3) message.repeated_int32.append(-2) message.repeated_int32.append(-1) message.repeated_int32.sort(key=abs) self.assertEqual(message.repeated_int32[0], -1) self.assertEqual(message.repeated_int32[1], -2) self.assertEqual(message.repeated_int32[2], -3) message.repeated_string.append('aaa') message.repeated_string.append('bb') message.repeated_string.append('c') message.repeated_string.sort(key=len) self.assertEqual(message.repeated_string[0], 'c') self.assertEqual(message.repeated_string[1], 'bb') self.assertEqual(message.repeated_string[2], 'aaa')
Example 2
Project: lambda-packs Author: ryfeus File: message_test.py License: MIT License | 6 votes |
def testLongValuedSlice(self, message_module): """It should be possible to use long-valued indicies in slices This didn't used to work in the v2 C++ implementation. """ m = message_module.TestAllTypes() # Repeated scalar m.repeated_int32.append(1) sl = m.repeated_int32[int(0):int(len(m.repeated_int32))] self.assertEqual(len(m.repeated_int32), len(sl)) # Repeated composite m.repeated_nested_message.add().bb = 3 sl = m.repeated_nested_message[int(0):int(len(m.repeated_nested_message))] self.assertEqual(len(m.repeated_nested_message), len(sl))
Example 3
Project: lambda-packs Author: ryfeus File: message_test.py License: MIT License | 6 votes |
def testSetRepeatedComposite(self, message_module): m = message_module.TestAllTypes() with self.assertRaises(AttributeError): m.repeated_int32 = [] m.repeated_int32.append(1) if api_implementation.Type() == 'cpp': # For test coverage: cpp has a different path if composite # field is in cache with self.assertRaises(TypeError): m.repeated_int32 = [] else: with self.assertRaises(AttributeError): m.repeated_int32 = [] # Class to test proto2-only features (required, extensions, etc.)
Example 4
Project: auto-alt-text-lambda-api Author: abhisuri97 File: message_test.py License: MIT License | 6 votes |
def testSortingRepeatedScalarFieldsCustomComparator(self, message_module): """Check some different types with custom comparator.""" message = message_module.TestAllTypes() message.repeated_int32.append(-3) message.repeated_int32.append(-2) message.repeated_int32.append(-1) message.repeated_int32.sort(key=abs) self.assertEqual(message.repeated_int32[0], -1) self.assertEqual(message.repeated_int32[1], -2) self.assertEqual(message.repeated_int32[2], -3) message.repeated_string.append('aaa') message.repeated_string.append('bb') message.repeated_string.append('c') message.repeated_string.sort(key=len) self.assertEqual(message.repeated_string[0], 'c') self.assertEqual(message.repeated_string[1], 'bb') self.assertEqual(message.repeated_string[2], 'aaa')
Example 5
Project: sklearn-theano Author: sklearn-theano File: message_test.py License: BSD 3-Clause "New" or "Revised" License | 6 votes |
def testSortingRepeatedScalarFieldsCustomComparator(self, message_module): """Check some different types with custom comparator.""" message = message_module.TestAllTypes() message.repeated_int32.append(-3) message.repeated_int32.append(-2) message.repeated_int32.append(-1) message.repeated_int32.sort(key=abs) self.assertEqual(message.repeated_int32[0], -1) self.assertEqual(message.repeated_int32[1], -2) self.assertEqual(message.repeated_int32[2], -3) message.repeated_string.append('aaa') message.repeated_string.append('bb') message.repeated_string.append('c') message.repeated_string.sort(key=len) self.assertEqual(message.repeated_string[0], 'c') self.assertEqual(message.repeated_string[1], 'bb') self.assertEqual(message.repeated_string[2], 'aaa')
Example 6
Project: botchallenge Author: katharosada File: message_test.py License: MIT License | 6 votes |
def testSortingRepeatedScalarFieldsCustomComparator(self): """Check some different types with custom comparator.""" message = unittest_pb2.TestAllTypes() message.repeated_int32.append(-3) message.repeated_int32.append(-2) message.repeated_int32.append(-1) message.repeated_int32.sort(key=abs) self.assertEqual(message.repeated_int32[0], -1) self.assertEqual(message.repeated_int32[1], -2) self.assertEqual(message.repeated_int32[2], -3) message.repeated_string.append('aaa') message.repeated_string.append('bb') message.repeated_string.append('c') message.repeated_string.sort(key=len) self.assertEqual(message.repeated_string[0], 'c') self.assertEqual(message.repeated_string[1], 'bb') self.assertEqual(message.repeated_string[2], 'aaa')
Example 7
Project: coremltools Author: apple File: message_test.py License: BSD 3-Clause "New" or "Revised" License | 6 votes |
def testSortingRepeatedScalarFieldsCustomComparator(self, message_module): """Check some different types with custom comparator.""" message = message_module.TestAllTypes() message.repeated_int32.append(-3) message.repeated_int32.append(-2) message.repeated_int32.append(-1) message.repeated_int32.sort(key=abs) self.assertEqual(message.repeated_int32[0], -1) self.assertEqual(message.repeated_int32[1], -2) self.assertEqual(message.repeated_int32[2], -3) message.repeated_string.append('aaa') message.repeated_string.append('bb') message.repeated_string.append('c') message.repeated_string.sort(key=len) self.assertEqual(message.repeated_string[0], 'c') self.assertEqual(message.repeated_string[1], 'bb') self.assertEqual(message.repeated_string[2], 'aaa')
Example 8
Project: coremltools Author: apple File: message_test.py License: BSD 3-Clause "New" or "Revised" License | 6 votes |
def testLongValuedSlice(self, message_module): """It should be possible to use long-valued indicies in slices This didn't used to work in the v2 C++ implementation. """ m = message_module.TestAllTypes() # Repeated scalar m.repeated_int32.append(1) sl = m.repeated_int32[long(0):long(len(m.repeated_int32))] self.assertEqual(len(m.repeated_int32), len(sl)) # Repeated composite m.repeated_nested_message.add().bb = 3 sl = m.repeated_nested_message[long(0):long(len(m.repeated_nested_message))] self.assertEqual(len(m.repeated_nested_message), len(sl))
Example 9
Project: coremltools Author: apple File: message_test.py License: BSD 3-Clause "New" or "Revised" License | 6 votes |
def testSortingRepeatedScalarFieldsCustomComparator(self): """Check some different types with custom comparator.""" message = unittest_pb2.TestAllTypes() message.repeated_int32.append(-3) message.repeated_int32.append(-2) message.repeated_int32.append(-1) message.repeated_int32.sort(lambda x,y: cmp(abs(x), abs(y))) self.assertEqual(message.repeated_int32[0], -1) self.assertEqual(message.repeated_int32[1], -2) self.assertEqual(message.repeated_int32[2], -3) message.repeated_string.append('aaa') message.repeated_string.append('bb') message.repeated_string.append('c') message.repeated_string.sort(lambda x,y: cmp(len(x), len(y))) self.assertEqual(message.repeated_string[0], 'c') self.assertEqual(message.repeated_string[1], 'bb') self.assertEqual(message.repeated_string[2], 'aaa')
Example 10
Project: go2mapillary Author: enricofer File: message_test.py License: GNU General Public License v3.0 | 6 votes |
def testSortingRepeatedScalarFieldsCustomComparator(self, message_module): """Check some different types with custom comparator.""" message = message_module.TestAllTypes() message.repeated_int32.append(-3) message.repeated_int32.append(-2) message.repeated_int32.append(-1) message.repeated_int32.sort(key=abs) self.assertEqual(message.repeated_int32[0], -1) self.assertEqual(message.repeated_int32[1], -2) self.assertEqual(message.repeated_int32[2], -3) message.repeated_string.append('aaa') message.repeated_string.append('bb') message.repeated_string.append('c') message.repeated_string.sort(key=len) self.assertEqual(message.repeated_string[0], 'c') self.assertEqual(message.repeated_string[1], 'bb') self.assertEqual(message.repeated_string[2], 'aaa')
Example 11
Project: lambda-packs Author: ryfeus File: message_test.py License: MIT License | 5 votes |
def testSortingRepeatedScalarFieldsDefaultComparator(self, message_module): """Check some different types with the default comparator.""" message = message_module.TestAllTypes() # TODO(mattp): would testing more scalar types strengthen test? message.repeated_int32.append(1) message.repeated_int32.append(3) message.repeated_int32.append(2) message.repeated_int32.sort() self.assertEqual(message.repeated_int32[0], 1) self.assertEqual(message.repeated_int32[1], 2) self.assertEqual(message.repeated_int32[2], 3) self.assertEqual(str(message.repeated_int32), str([1, 2, 3])) message.repeated_float.append(1.1) message.repeated_float.append(1.3) message.repeated_float.append(1.2) message.repeated_float.sort() self.assertAlmostEqual(message.repeated_float[0], 1.1) self.assertAlmostEqual(message.repeated_float[1], 1.2) self.assertAlmostEqual(message.repeated_float[2], 1.3) message.repeated_string.append('a') message.repeated_string.append('c') message.repeated_string.append('b') message.repeated_string.sort() self.assertEqual(message.repeated_string[0], 'a') self.assertEqual(message.repeated_string[1], 'b') self.assertEqual(message.repeated_string[2], 'c') self.assertEqual(str(message.repeated_string), str(['a', 'b', 'c'])) message.repeated_bytes.append(b'a') message.repeated_bytes.append(b'c') message.repeated_bytes.append(b'b') message.repeated_bytes.sort() self.assertEqual(message.repeated_bytes[0], b'a') self.assertEqual(message.repeated_bytes[1], b'b') self.assertEqual(message.repeated_bytes[2], b'c') self.assertEqual(str(message.repeated_bytes), str([b'a', b'b', b'c']))
Example 12
Project: lambda-packs Author: ryfeus File: message_test.py License: MIT License | 5 votes |
def testRepeatedScalarFieldSortArguments(self, message_module): """Check sorting a scalar field using list.sort() arguments.""" message = message_module.TestAllTypes() message.repeated_int32.append(-3) message.repeated_int32.append(-2) message.repeated_int32.append(-1) message.repeated_int32.sort(key=abs) self.assertEqual(list(message.repeated_int32), [-1, -2, -3]) message.repeated_int32.sort(key=abs, reverse=True) self.assertEqual(list(message.repeated_int32), [-3, -2, -1]) if sys.version_info < (3,): # No cmp sorting in PY3. abs_cmp = lambda a, b: cmp(abs(a), abs(b)) message.repeated_int32.sort(sort_function=abs_cmp) self.assertEqual(list(message.repeated_int32), [-1, -2, -3]) message.repeated_int32.sort(cmp=abs_cmp, reverse=True) self.assertEqual(list(message.repeated_int32), [-3, -2, -1]) message.repeated_string.append('aaa') message.repeated_string.append('bb') message.repeated_string.append('c') message.repeated_string.sort(key=len) self.assertEqual(list(message.repeated_string), ['c', 'bb', 'aaa']) message.repeated_string.sort(key=len, reverse=True) self.assertEqual(list(message.repeated_string), ['aaa', 'bb', 'c']) if sys.version_info < (3,): # No cmp sorting in PY3. len_cmp = lambda a, b: cmp(len(a), len(b)) message.repeated_string.sort(sort_function=len_cmp) self.assertEqual(list(message.repeated_string), ['c', 'bb', 'aaa']) message.repeated_string.sort(cmp=len_cmp, reverse=True) self.assertEqual(list(message.repeated_string), ['aaa', 'bb', 'c'])
Example 13
Project: lambda-packs Author: ryfeus File: message_test.py License: MIT License | 5 votes |
def testRepeatedFieldsComparable(self, message_module): m1 = message_module.TestAllTypes() m2 = message_module.TestAllTypes() m1.repeated_int32.append(0) m1.repeated_int32.append(1) m1.repeated_int32.append(2) m2.repeated_int32.append(0) m2.repeated_int32.append(1) m2.repeated_int32.append(2) m1.repeated_nested_message.add().bb = 1 m1.repeated_nested_message.add().bb = 2 m1.repeated_nested_message.add().bb = 3 m2.repeated_nested_message.add().bb = 1 m2.repeated_nested_message.add().bb = 2 m2.repeated_nested_message.add().bb = 3 if sys.version_info >= (3,): return # No cmp() in PY3. # These comparisons should not raise errors. _ = m1 < m2 _ = m1.repeated_nested_message < m2.repeated_nested_message # Make sure cmp always works. If it wasn't defined, these would be # id() comparisons and would all fail. self.assertEqual(cmp(m1, m2), 0) self.assertEqual(cmp(m1.repeated_int32, m2.repeated_int32), 0) self.assertEqual(cmp(m1.repeated_int32, [0, 1, 2]), 0) self.assertEqual(cmp(m1.repeated_nested_message, m2.repeated_nested_message), 0) with self.assertRaises(TypeError): # Can't compare repeated composite containers to lists. cmp(m1.repeated_nested_message, m2.repeated_nested_message[:]) # TODO(anuraag): Implement extensiondict comparison in C++ and then add test
Example 14
Project: lambda-packs Author: ryfeus File: message_test.py License: MIT License | 5 votes |
def testRepeatedFieldsAreSequences(self, message_module): m = message_module.TestAllTypes() self.assertIsInstance(m.repeated_int32, collections.MutableSequence) self.assertIsInstance(m.repeated_nested_message, collections.MutableSequence)
Example 15
Project: lambda-packs Author: ryfeus File: message_test.py License: MIT License | 5 votes |
def testRepeatedFieldInsideNestedMessage(self, message_module): m = message_module.NestedTestAllTypes() m.payload.repeated_int32.extend([]) self.assertTrue(m.HasField('payload'))
Example 16
Project: lambda-packs Author: ryfeus File: message_test.py License: MIT License | 5 votes |
def testExtendShouldNotSwallowExceptions(self, message_module): """This didn't use to work in the v2 C++ implementation.""" m = message_module.TestAllTypes() with self.assertRaises(NameError) as _: m.repeated_int32.extend(a for i in range(10)) # pylint: disable=undefined-variable with self.assertRaises(NameError) as _: m.repeated_nested_enum.extend( a for i in range(10)) # pylint: disable=undefined-variable
Example 17
Project: lambda-packs Author: ryfeus File: message_test.py License: MIT License | 5 votes |
def testExtendInt32WithNothing(self, message_module): """Test no-ops extending repeated int32 fields.""" m = message_module.TestAllTypes() self.assertSequenceEqual([], m.repeated_int32) # TODO(ptucker): Deprecate this behavior. b/18413862 for falsy_value in MessageTest.FALSY_VALUES: m.repeated_int32.extend(falsy_value) self.assertSequenceEqual([], m.repeated_int32) m.repeated_int32.extend([]) self.assertSequenceEqual([], m.repeated_int32)
Example 18
Project: lambda-packs Author: ryfeus File: message_test.py License: MIT License | 5 votes |
def testExtendInt32WithPythonList(self, message_module): """Test extending repeated int32 fields with python lists.""" m = message_module.TestAllTypes() self.assertSequenceEqual([], m.repeated_int32) m.repeated_int32.extend([0]) self.assertSequenceEqual([0], m.repeated_int32) m.repeated_int32.extend([1, 2]) self.assertSequenceEqual([0, 1, 2], m.repeated_int32) m.repeated_int32.extend([3, 4]) self.assertSequenceEqual([0, 1, 2, 3, 4], m.repeated_int32)
Example 19
Project: lambda-packs Author: ryfeus File: message_test.py License: MIT License | 5 votes |
def testPickleRepeatedScalarContainer(self, message_module): # TODO(tibell): The pure-Python implementation support pickling of # scalar containers in *some* cases. For now the cpp2 version # throws an exception to avoid a segfault. Investigate if we # want to support pickling of these fields. # # For more information see: https://b2.corp.google.com/u/0/issues/18677897 if (api_implementation.Type() != 'cpp' or api_implementation.Version() == 2): return m = message_module.TestAllTypes() with self.assertRaises(pickle.PickleError) as _: pickle.dumps(m.repeated_int32, pickle.HIGHEST_PROTOCOL)
Example 20
Project: lambda-packs Author: ryfeus File: message_test.py License: MIT License | 5 votes |
def testHasFieldOnRepeatedField(self, message_module): """Using HasField on a repeated field should raise an exception. """ m = message_module.TestAllTypes() with self.assertRaises(ValueError) as _: m.HasField('repeated_int32')
Example 21
Project: lambda-packs Author: ryfeus File: message_test.py License: MIT License | 5 votes |
def testRepeatedScalarFieldPop(self, message_module): m = message_module.TestAllTypes() with self.assertRaises(IndexError) as _: m.repeated_int32.pop() m.repeated_int32.extend(list(range(5))) self.assertEqual(4, m.repeated_int32.pop()) self.assertEqual(0, m.repeated_int32.pop(0)) self.assertEqual(2, m.repeated_int32.pop(1)) self.assertEqual([1, 3], m.repeated_int32)
Example 22
Project: lambda-packs Author: ryfeus File: message_test.py License: MIT License | 5 votes |
def testRepeatedCompareWithSelf(self, message_module): m = message_module.TestAllTypes() for i in range(5): m.repeated_int32.insert(i, i) n = m.repeated_nested_message.add() n.bb = i self.assertSequenceEqual(m.repeated_int32, m.repeated_int32) self.assertEqual(m.repeated_nested_message, m.repeated_nested_message)
Example 23
Project: lambda-packs Author: ryfeus File: message_test.py License: MIT License | 5 votes |
def testTypeNamesCanBeImported(self): # If import doesn't work, pickling won't work either. pb = unittest_pb2.TestAllTypes() self.assertImportFromName(pb.repeated_int32, 'Scalar') self.assertImportFromName(pb.repeated_nested_message, 'Composite')
Example 24
Project: lambda-packs Author: ryfeus File: message_test.py License: MIT License | 5 votes |
def setMessage(self, message): message.repeated_int32.append(1) message.repeated_int64.append(1) message.repeated_uint32.append(1) message.repeated_uint64.append(1) message.repeated_sint32.append(1) message.repeated_sint64.append(1) message.repeated_fixed32.append(1) message.repeated_fixed64.append(1) message.repeated_sfixed32.append(1) message.repeated_sfixed64.append(1) message.repeated_float.append(1.0) message.repeated_double.append(1.0) message.repeated_bool.append(True) message.repeated_nested_enum.append(1)
Example 25
Project: auto-alt-text-lambda-api Author: abhisuri97 File: message_test.py License: MIT License | 5 votes |
def testSortingRepeatedScalarFieldsDefaultComparator(self, message_module): """Check some different types with the default comparator.""" message = message_module.TestAllTypes() # TODO(mattp): would testing more scalar types strengthen test? message.repeated_int32.append(1) message.repeated_int32.append(3) message.repeated_int32.append(2) message.repeated_int32.sort() self.assertEqual(message.repeated_int32[0], 1) self.assertEqual(message.repeated_int32[1], 2) self.assertEqual(message.repeated_int32[2], 3) message.repeated_float.append(1.1) message.repeated_float.append(1.3) message.repeated_float.append(1.2) message.repeated_float.sort() self.assertAlmostEqual(message.repeated_float[0], 1.1) self.assertAlmostEqual(message.repeated_float[1], 1.2) self.assertAlmostEqual(message.repeated_float[2], 1.3) message.repeated_string.append('a') message.repeated_string.append('c') message.repeated_string.append('b') message.repeated_string.sort() self.assertEqual(message.repeated_string[0], 'a') self.assertEqual(message.repeated_string[1], 'b') self.assertEqual(message.repeated_string[2], 'c') message.repeated_bytes.append(b'a') message.repeated_bytes.append(b'c') message.repeated_bytes.append(b'b') message.repeated_bytes.sort() self.assertEqual(message.repeated_bytes[0], b'a') self.assertEqual(message.repeated_bytes[1], b'b') self.assertEqual(message.repeated_bytes[2], b'c')
Example 26
Project: auto-alt-text-lambda-api Author: abhisuri97 File: message_test.py License: MIT License | 5 votes |
def testRepeatedScalarFieldSortArguments(self, message_module): """Check sorting a scalar field using list.sort() arguments.""" message = message_module.TestAllTypes() message.repeated_int32.append(-3) message.repeated_int32.append(-2) message.repeated_int32.append(-1) message.repeated_int32.sort(key=abs) self.assertEqual(list(message.repeated_int32), [-1, -2, -3]) message.repeated_int32.sort(key=abs, reverse=True) self.assertEqual(list(message.repeated_int32), [-3, -2, -1]) if sys.version_info < (3,): # No cmp sorting in PY3. abs_cmp = lambda a, b: cmp(abs(a), abs(b)) message.repeated_int32.sort(sort_function=abs_cmp) self.assertEqual(list(message.repeated_int32), [-1, -2, -3]) message.repeated_int32.sort(cmp=abs_cmp, reverse=True) self.assertEqual(list(message.repeated_int32), [-3, -2, -1]) message.repeated_string.append('aaa') message.repeated_string.append('bb') message.repeated_string.append('c') message.repeated_string.sort(key=len) self.assertEqual(list(message.repeated_string), ['c', 'bb', 'aaa']) message.repeated_string.sort(key=len, reverse=True) self.assertEqual(list(message.repeated_string), ['aaa', 'bb', 'c']) if sys.version_info < (3,): # No cmp sorting in PY3. len_cmp = lambda a, b: cmp(len(a), len(b)) message.repeated_string.sort(sort_function=len_cmp) self.assertEqual(list(message.repeated_string), ['c', 'bb', 'aaa']) message.repeated_string.sort(cmp=len_cmp, reverse=True) self.assertEqual(list(message.repeated_string), ['aaa', 'bb', 'c'])
Example 27
Project: auto-alt-text-lambda-api Author: abhisuri97 File: message_test.py License: MIT License | 5 votes |
def testRepeatedFieldsComparable(self, message_module): m1 = message_module.TestAllTypes() m2 = message_module.TestAllTypes() m1.repeated_int32.append(0) m1.repeated_int32.append(1) m1.repeated_int32.append(2) m2.repeated_int32.append(0) m2.repeated_int32.append(1) m2.repeated_int32.append(2) m1.repeated_nested_message.add().bb = 1 m1.repeated_nested_message.add().bb = 2 m1.repeated_nested_message.add().bb = 3 m2.repeated_nested_message.add().bb = 1 m2.repeated_nested_message.add().bb = 2 m2.repeated_nested_message.add().bb = 3 if sys.version_info >= (3,): return # No cmp() in PY3. # These comparisons should not raise errors. _ = m1 < m2 _ = m1.repeated_nested_message < m2.repeated_nested_message # Make sure cmp always works. If it wasn't defined, these would be # id() comparisons and would all fail. self.assertEqual(cmp(m1, m2), 0) self.assertEqual(cmp(m1.repeated_int32, m2.repeated_int32), 0) self.assertEqual(cmp(m1.repeated_int32, [0, 1, 2]), 0) self.assertEqual(cmp(m1.repeated_nested_message, m2.repeated_nested_message), 0) with self.assertRaises(TypeError): # Can't compare repeated composite containers to lists. cmp(m1.repeated_nested_message, m2.repeated_nested_message[:]) # TODO(anuraag): Implement extensiondict comparison in C++ and then add test
Example 28
Project: auto-alt-text-lambda-api Author: abhisuri97 File: message_test.py License: MIT License | 5 votes |
def testRepeatedFieldsAreSequences(self, message_module): m = message_module.TestAllTypes() self.assertIsInstance(m.repeated_int32, collections.MutableSequence) self.assertIsInstance(m.repeated_nested_message, collections.MutableSequence)
Example 29
Project: auto-alt-text-lambda-api Author: abhisuri97 File: message_test.py License: MIT License | 5 votes |
def testExtendShouldNotSwallowExceptions(self, message_module): """This didn't use to work in the v2 C++ implementation.""" m = message_module.TestAllTypes() with self.assertRaises(NameError) as _: m.repeated_int32.extend(a for i in range(10)) # pylint: disable=undefined-variable with self.assertRaises(NameError) as _: m.repeated_nested_enum.extend( a for i in range(10)) # pylint: disable=undefined-variable
Example 30
Project: auto-alt-text-lambda-api Author: abhisuri97 File: message_test.py License: MIT License | 5 votes |
def testExtendInt32WithNothing(self, message_module): """Test no-ops extending repeated int32 fields.""" m = message_module.TestAllTypes() self.assertSequenceEqual([], m.repeated_int32) # TODO(ptucker): Deprecate this behavior. b/18413862 for falsy_value in MessageTest.FALSY_VALUES: m.repeated_int32.extend(falsy_value) self.assertSequenceEqual([], m.repeated_int32) m.repeated_int32.extend([]) self.assertSequenceEqual([], m.repeated_int32)