aboutsummaryrefslogtreecommitdiffhomepage
path: root/python/google/protobuf/internal/reflection_test.py
diff options
context:
space:
mode:
authorGravatar jieluo@google.com <jieluo@google.com@630680e5-0e50-0410-840e-4b1c322b438d>2014-08-25 20:17:53 +0000
committerGravatar jieluo@google.com <jieluo@google.com@630680e5-0e50-0410-840e-4b1c322b438d>2014-08-25 20:17:53 +0000
commit1eba9d9c7424235b1a6dcd866fcd06d12e08a7f3 (patch)
treeb2a894794db1f6147214e356c20f754e270f4e7f /python/google/protobuf/internal/reflection_test.py
parent786379af4766fa7ec22b51862ba6e84156b1f9cb (diff)
merge tags/2.6.0 into trunk
Diffstat (limited to 'python/google/protobuf/internal/reflection_test.py')
-rwxr-xr-xpython/google/protobuf/internal/reflection_test.py23
1 files changed, 1 insertions, 22 deletions
diff --git a/python/google/protobuf/internal/reflection_test.py b/python/google/protobuf/internal/reflection_test.py
index 587246a7..b3c414c7 100755
--- a/python/google/protobuf/internal/reflection_test.py
+++ b/python/google/protobuf/internal/reflection_test.py
@@ -41,7 +41,6 @@ import copy
import gc
import operator
import struct
-import sys
from google.apputils import basetest
from google.protobuf import unittest_import_pb2
@@ -1557,20 +1556,7 @@ class ReflectionTest(basetest.TestCase):
def assertNotInitialized(self, proto):
self.assertFalse(proto.IsInitialized())
- try:
- proto.SerializeToString()
- except message.EncodeError:
- return
- except:
- # C++ implementation in opensource do not consider the catched
- # exception google.protobuf.message.EncodeError same as
- # message.EncodeError. Add an additional catch to deal with it.
- if api_implementation.Type() == 'python':
- raise self.failureException('message.EncodeError not raised')
- self.assertEqual('<class \'google.protobuf.message.EncodeError\'>',
- str(sys.exc_info()[0]))
- else:
- raise self.failureException('message.EncodeError not raised')
+ self.assertRaises(message.EncodeError, proto.SerializeToString)
# "Partial" serialization doesn't care if message is uninitialized.
proto.SerializePartialToString()
@@ -2500,13 +2486,6 @@ class SerializationTest(basetest.TestCase):
# Check if the exception message is the right one.
self.assertEqual(exception, str(ex))
return
- except:
- # C++ implementation in opensource do not consider the catched
- # exception google.protobuf.message.EncodeError same as
- # message.EncodeError. Add an additional catch to deal with it.
- if api_implementation.Type() == 'python':
- raise self.failureException('%s not raised' % str(exc_class))
- self.assertEqual(exception, str(sys.exc_info()[1]))
else:
raise self.failureException('%s not raised' % str(exc_class))