소스 검색

Make pytype happy

Lidi Zheng 5 년 전
부모
커밋
8429fec1b5
2개의 변경된 파일9개의 추가작업 그리고 14개의 파일을 삭제
  1. 5 6
      src/python/grpcio/grpc/experimental/aio/__init__.py
  2. 4 8
      src/python/grpcio_tests/tests_aio/unit/abort_test.py

+ 5 - 6
src/python/grpcio/grpc/experimental/aio/__init__.py

@@ -24,13 +24,12 @@ import six
 import grpc
 from grpc._cython.cygrpc import init_grpc_aio
 
-from ._base_call import RpcContext, Call, UnaryUnaryCall, UnaryStreamCall
+from ._base_call import Call, RpcContext, UnaryStreamCall, UnaryUnaryCall
 from ._call import AioRpcError
-from ._channel import Channel
-from ._channel import UnaryUnaryMultiCallable
-from ._interceptor import ClientCallDetails, UnaryUnaryClientInterceptor
-from ._interceptor import InterceptedUnaryUnaryCall
-from ._server import server, Server
+from ._channel import Channel, UnaryUnaryMultiCallable
+from ._interceptor import (ClientCallDetails, InterceptedUnaryUnaryCall,
+                           UnaryUnaryClientInterceptor)
+from ._server import Server, server
 
 
 def insecure_channel(

+ 4 - 8
src/python/grpcio_tests/tests_aio/unit/abort_test.py

@@ -101,11 +101,10 @@ class TestServer(AioTestBase):
         self.assertEqual(_ABORT_CODE, await call.code())
         self.assertEqual(_ABORT_DETAILS, await call.details())
 
-        with self.assertRaises(grpc.RpcError) as exception_context:
+        with self.assertRaises(aio.AioRpcError) as exception_context:
             await call
 
         rpc_error = exception_context.exception
-        rpc_error.code()
         self.assertEqual(_ABORT_CODE, rpc_error.code())
         self.assertEqual(_ABORT_DETAILS, rpc_error.details())
 
@@ -113,11 +112,10 @@ class TestServer(AioTestBase):
         method = self._channel.unary_unary(_SUPPRESS_ABORT)
         call = method(_REQUEST)
 
-        with self.assertRaises(grpc.RpcError) as exception_context:
+        with self.assertRaises(aio.AioRpcError) as exception_context:
             await call
 
         rpc_error = exception_context.exception
-        rpc_error.code()
         self.assertEqual(_ABORT_CODE, rpc_error.code())
         self.assertEqual(_ABORT_DETAILS, rpc_error.details())
 
@@ -125,11 +123,10 @@ class TestServer(AioTestBase):
         method = self._channel.unary_unary(_REPLACE_ABORT)
         call = method(_REQUEST)
 
-        with self.assertRaises(grpc.RpcError) as exception_context:
+        with self.assertRaises(aio.AioRpcError) as exception_context:
             await call
 
         rpc_error = exception_context.exception
-        rpc_error.code()
         self.assertEqual(_ABORT_CODE, rpc_error.code())
         self.assertEqual(_ABORT_DETAILS, rpc_error.details())
 
@@ -137,11 +134,10 @@ class TestServer(AioTestBase):
         method = self._channel.unary_stream(_ABORT_AFTER_REPLY)
         call = method(_REQUEST)
 
-        with self.assertRaises(grpc.RpcError) as exception_context:
+        with self.assertRaises(aio.AioRpcError) as exception_context:
             await call.read()
 
         rpc_error = exception_context.exception
-        rpc_error.code()
         self.assertEqual(_ABORT_CODE, rpc_error.code())
         self.assertEqual(_ABORT_DETAILS, rpc_error.details())