Skip to content

Commit 5864b50

Browse files
authored
Revert "Remove deprecated service.py usages from test". For 29.x only (#19434)
This reverts commit 471ff77.
1 parent e0a3978 commit 5864b50

File tree

3 files changed

+15
-9
lines changed

3 files changed

+15
-9
lines changed

python/google/protobuf/internal/generator_test.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import unittest
2020

2121
from google.protobuf.internal import test_bad_identifiers_pb2
22+
from google.protobuf import service
2223
from google.protobuf import symbol_database
2324
from google.protobuf import unittest_import_pb2
2425
from google.protobuf import unittest_import_public_pb2
@@ -282,6 +283,12 @@ def testNoGenericServices(self):
282283
self.assertTrue(hasattr(unittest_no_generic_services_pb2, "FOO"))
283284
self.assertTrue(hasattr(unittest_no_generic_services_pb2, "test_extension"))
284285

286+
# Make sure unittest_no_generic_services_pb2 has no services subclassing
287+
# Proto2 Service class.
288+
if hasattr(unittest_no_generic_services_pb2, "TestService"):
289+
self.assertFalse(issubclass(unittest_no_generic_services_pb2.TestService,
290+
service.Service))
291+
285292
def testMessageTypesByName(self):
286293
file_type = unittest_pb2.DESCRIPTOR
287294
self.assertEqual(

python/google/protobuf/internal/service_reflection_test.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,21 @@
1313
import unittest
1414

1515
from google.protobuf import service_reflection
16+
from google.protobuf import service
1617
from google.protobuf import unittest_pb2
1718

1819

1920
class FooUnitTest(unittest.TestCase):
2021

2122
def testService(self):
22-
23-
class MockRpcChannel:
23+
class MockRpcChannel(service.RpcChannel):
2424
def CallMethod(self, method, controller, request, response, callback):
2525
self.method = method
2626
self.controller = controller
2727
self.request = request
2828
callback(response)
2929

30-
class MockRpcController:
30+
class MockRpcController(service.RpcController):
3131
def SetFailed(self, msg):
3232
self.failure_message = msg
3333

@@ -81,8 +81,7 @@ def Bar(self, rpc_controller, request, done):
8181
self.assertEqual(True, srvc.bar_called)
8282

8383
def testServiceStub(self):
84-
85-
class MockRpcChannel:
84+
class MockRpcChannel(service.RpcChannel):
8685
def CallMethod(self, method, controller, request,
8786
response_class, callback):
8887
self.method = method

python/google/protobuf/service.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,12 @@ def CallMethod(self, method_descriptor, rpc_controller,
7070
Postconditions:
7171
7272
* "done" will be called when the method is complete. This may be
73-
before CallMethod() returns or it may be at some point in the future.
73+
before CallMethod() returns or it may be at some point in the future.
7474
* If the RPC failed, the response value passed to "done" will be None.
75-
Further details about the failure can be found by querying the
76-
RpcController.
75+
Further details about the failure can be found by querying the
76+
RpcController.
7777
"""
78-
raise NotImplementedError
78+
raise NotImplementedError
7979

8080
def GetRequestClass(self, method_descriptor):
8181
"""Returns the class of the request message for the specified method.

0 commit comments

Comments
 (0)