aboutsummaryrefslogtreecommitdiffhomepage
path: root/python/google/protobuf/internal/reflection_test.py
diff options
context:
space:
mode:
authorGravatar Jisi Liu <jisi.liu@gmail.com>2015-02-25 16:39:11 -0800
committerGravatar Jisi Liu <jisi.liu@gmail.com>2015-02-25 16:39:11 -0800
commitada65567852b96fdb4d070c0c3f86ca7b77824f9 (patch)
treea506994ce921ace3e6f88ca130a17af7f85c3d0f /python/google/protobuf/internal/reflection_test.py
parent581be24606a925d038f382dc4c86256e2d29e001 (diff)
Down integrate from Google internal.
Change-Id: I34d301133eea9c6f3a822c47d1f91e136fd33145
Diffstat (limited to 'python/google/protobuf/internal/reflection_test.py')
-rwxr-xr-xpython/google/protobuf/internal/reflection_test.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/python/google/protobuf/internal/reflection_test.py b/python/google/protobuf/internal/reflection_test.py
index 6b24b092..8ac76c63 100755
--- a/python/google/protobuf/internal/reflection_test.py
+++ b/python/google/protobuf/internal/reflection_test.py
@@ -1792,6 +1792,27 @@ class ReflectionTest(basetest.TestCase):
# Just check the default value.
self.assertEqual(57, msg.inner.value)
+ @basetest.unittest.skipIf(
+ api_implementation.Type() != 'cpp' or api_implementation.Version() != 2,
+ 'CPPv2-specific test')
+ def testBadArguments(self):
+ # Some of these assertions used to segfault.
+ from google.protobuf.pyext import _message
+ self.assertRaises(TypeError, _message.Message._GetFieldDescriptor, 3)
+ self.assertRaises(TypeError, _message.Message._GetExtensionDescriptor, 42)
+ self.assertRaises(TypeError,
+ unittest_pb2.TestAllTypes().__getattribute__, 42)
+
+ @basetest.unittest.skipIf(
+ api_implementation.Type() != 'cpp' or api_implementation.Version() != 2,
+ 'CPPv2-specific test')
+ def testRosyHack(self):
+ from google.protobuf.pyext import _message
+ from google3.gdata.rosy.proto import core_api2_pb2
+ from google3.gdata.rosy.proto import core_pb2
+ self.assertEqual(_message.Message, core_pb2.PageSelection.__base__)
+ self.assertEqual(_message.Message, core_api2_pb2.PageSelection.__base__)
+
# Since we had so many tests for protocol buffer equality, we broke these out
# into separate TestCase classes.