aboutsummaryrefslogtreecommitdiff
path: root/python/google/protobuf/internal/service_reflection_test.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/google/protobuf/internal/service_reflection_test.py')
-rwxr-xr-xpython/google/protobuf/internal/service_reflection_test.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/python/google/protobuf/internal/service_reflection_test.py b/python/google/protobuf/internal/service_reflection_test.py
index 9967255a..98614b77 100755
--- a/python/google/protobuf/internal/service_reflection_test.py
+++ b/python/google/protobuf/internal/service_reflection_test.py
@@ -34,7 +34,10 @@
__author__ = 'petar@google.com (Petar Petrov)'
-import unittest
+try:
+ import unittest2 as unittest
+except ImportError:
+ import unittest
from google.protobuf import unittest_pb2
from google.protobuf import service_reflection
from google.protobuf import service
@@ -80,7 +83,7 @@ class FooUnitTest(unittest.TestCase):
self.assertEqual('Method Bar not implemented.',
rpc_controller.failure_message)
self.assertEqual(None, self.callback_response)
-
+
class MyServiceImpl(unittest_pb2.TestService):
def Foo(self, rpc_controller, request, done):
self.foo_called = True
@@ -125,8 +128,7 @@ class FooUnitTest(unittest.TestCase):
# Invoke method.
stub.Foo(rpc_controller, request, MyCallback)
- self.assertTrue(isinstance(self.callback_response,
- unittest_pb2.FooResponse))
+ self.assertIsInstance(self.callback_response, unittest_pb2.FooResponse)
self.assertEqual(request, channel.request)
self.assertEqual(rpc_controller, channel.controller)
self.assertEqual(stub.GetDescriptor().methods[0], channel.method)