Index: third_party/protobuf/python/google/protobuf/internal/service_reflection_test.py |
diff --git a/third_party/protobuf/python/google/protobuf/internal/service_reflection_test.py b/third_party/protobuf/python/google/protobuf/internal/service_reflection_test.py |
index e04f8252c0400e79846195ba15a969339a657bfb..98614b77f63ae80e3a0f03a9457b71ac0ffca7af 100755 |
--- a/third_party/protobuf/python/google/protobuf/internal/service_reflection_test.py |
+++ b/third_party/protobuf/python/google/protobuf/internal/service_reflection_test.py |
@@ -1,8 +1,8 @@ |
-#! /usr/bin/python |
+#! /usr/bin/env python |
# |
# Protocol Buffers - Google's data interchange format |
# Copyright 2008 Google Inc. All rights reserved. |
-# http://code.google.com/p/protobuf/ |
+# https://developers.google.com/protocol-buffers/ |
# |
# Redistribution and use in source and binary forms, with or without |
# modification, are permitted provided that the following conditions are |
@@ -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 |
@@ -118,15 +121,14 @@ class FooUnitTest(unittest.TestCase): |
rpc_controller = 'controller' |
request = 'request' |
- # GetDescriptor now static, still works as instance method for compatability |
+ # GetDescriptor now static, still works as instance method for compatibility |
self.assertEqual(unittest_pb2.TestService_Stub.GetDescriptor(), |
stub.GetDescriptor()) |
# 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) |