Make YAPF happy

pull/21455/head
Pau Freixes 5 years ago
parent 2a342b22a7
commit db54580f20
  1. 14
      src/python/grpcio_tests/tests_aio/unit/_test_server.py
  2. 6
      src/python/grpcio_tests/tests_aio/unit/channel_test.py
  3. 19
      src/python/grpcio_tests/tests_aio/unit/interceptor_test.py

@ -54,17 +54,17 @@ class _TestServiceServicer(test_pb2_grpc.TestServiceServicer):
async def start_test_server():
server = aio.server(options=(('grpc.so_reuseport', 0),))
servicer = _TestServiceServicer()
test_pb2_grpc.add_TestServiceServicer_to_server(servicer,
server)
test_pb2_grpc.add_TestServiceServicer_to_server(servicer, server)
# Add programatically extra methods not provided by the proto file
# that are used during the tests
rpc_method_handlers = {
'UnaryCallWithSleep': grpc.unary_unary_rpc_method_handler(
servicer.UnaryCallWithSleep,
request_deserializer=messages_pb2.SimpleRequest.FromString,
response_serializer=messages_pb2.SimpleResponse.SerializeToString
)
'UnaryCallWithSleep':
grpc.unary_unary_rpc_method_handler(
servicer.UnaryCallWithSleep,
request_deserializer=messages_pb2.SimpleRequest.FromString,
response_serializer=messages_pb2.SimpleResponse.
SerializeToString)
}
extra_handler = grpc.method_handlers_generic_handler(
'grpc.testing.TestService', rpc_method_handlers)

@ -70,7 +70,8 @@ class TestChannel(AioTestBase):
)
with self.assertRaises(grpc.RpcError) as exception_context:
await hi(messages_pb2.SimpleRequest(), timeout=UNARY_CALL_WITH_SLEEP_VALUE / 2)
await hi(messages_pb2.SimpleRequest(),
timeout=UNARY_CALL_WITH_SLEEP_VALUE / 2)
_, details = grpc.StatusCode.DEADLINE_EXCEEDED.value # pylint: disable=unused-variable
self.assertEqual(grpc.StatusCode.DEADLINE_EXCEEDED,
@ -89,7 +90,8 @@ class TestChannel(AioTestBase):
response_deserializer=messages_pb2.SimpleResponse.FromString,
)
call = hi(messages_pb2.SimpleRequest(), timeout=UNARY_CALL_WITH_SLEEP_VALUE * 2)
call = hi(messages_pb2.SimpleRequest(),
timeout=UNARY_CALL_WITH_SLEEP_VALUE * 2)
self.assertEqual(await call.code(), grpc.StatusCode.OK)
async def test_unary_stream(self):

@ -22,7 +22,6 @@ from tests_aio.unit._test_server import start_test_server, UNARY_CALL_WITH_SLEEP
from tests_aio.unit._test_base import AioTestBase
from src.proto.grpc.testing import messages_pb2
_LOCAL_CANCEL_DETAILS_EXPECTATION = 'Locally cancelled by application!'
@ -234,8 +233,8 @@ class TestUnaryUnaryClientInterceptor(AioTestBase):
interceptor, interceptor_response = Interceptor(), ResponseInterceptor()
async with aio.insecure_channel(
self._server_target, interceptors=[interceptor,
interceptor_response]) as channel:
self._server_target,
interceptors=[interceptor, interceptor_response]) as channel:
multicallable = channel.unary_unary(
'/grpc.testing.TestService/UnaryCall',
@ -277,7 +276,6 @@ class TestInterceptedUnaryUnaryCall(AioTestBase):
call = await continuation(client_call_details, request)
return call
async with aio.insecure_channel(self._server_target,
interceptors=[Interceptor()
]) as channel:
@ -307,7 +305,6 @@ class TestInterceptedUnaryUnaryCall(AioTestBase):
await call
return call
async with aio.insecure_channel(self._server_target,
interceptors=[Interceptor()
]) as channel:
@ -336,7 +333,6 @@ class TestInterceptedUnaryUnaryCall(AioTestBase):
call = await continuation(client_call_details, request)
return call
async with aio.insecure_channel(self._server_target,
interceptors=[Interceptor()
]) as channel:
@ -346,7 +342,8 @@ class TestInterceptedUnaryUnaryCall(AioTestBase):
request_serializer=messages_pb2.SimpleRequest.SerializeToString,
response_deserializer=messages_pb2.SimpleResponse.FromString)
call = multicallable(messages_pb2.SimpleRequest(), timeout=UNARY_CALL_WITH_SLEEP_VALUE / 2)
call = multicallable(messages_pb2.SimpleRequest(),
timeout=UNARY_CALL_WITH_SLEEP_VALUE / 2)
with self.assertRaises(aio.AioRpcError) as exception_context:
await call
@ -369,7 +366,6 @@ class TestInterceptedUnaryUnaryCall(AioTestBase):
await call
return call
async with aio.insecure_channel(self._server_target,
interceptors=[Interceptor()
]) as channel:
@ -379,7 +375,8 @@ class TestInterceptedUnaryUnaryCall(AioTestBase):
request_serializer=messages_pb2.SimpleRequest.SerializeToString,
response_deserializer=messages_pb2.SimpleResponse.FromString)
call = multicallable(messages_pb2.SimpleRequest(), timeout=UNARY_CALL_WITH_SLEEP_VALUE / 2)
call = multicallable(messages_pb2.SimpleRequest(),
timeout=UNARY_CALL_WITH_SLEEP_VALUE / 2)
with self.assertRaises(aio.AioRpcError) as exception_context:
await call
@ -406,7 +403,6 @@ class TestInterceptedUnaryUnaryCall(AioTestBase):
# This line should never be reached
raise Exception()
async with aio.insecure_channel(self._server_target,
interceptors=[Interceptor()
]) as channel:
@ -450,7 +446,6 @@ class TestInterceptedUnaryUnaryCall(AioTestBase):
# This line should never be reached
raise Exception()
async with aio.insecure_channel(self._server_target,
interceptors=[Interceptor()
]) as channel:
@ -489,7 +484,6 @@ class TestInterceptedUnaryUnaryCall(AioTestBase):
await call
return call
async with aio.insecure_channel(self._server_target,
interceptors=[Interceptor()
]) as channel:
@ -521,7 +515,6 @@ class TestInterceptedUnaryUnaryCall(AioTestBase):
call.cancel()
return call
async with aio.insecure_channel(self._server_target,
interceptors=[Interceptor()
]) as channel:

Loading…
Cancel
Save