Remove metadata as optional from AioRpcError

pull/23045/head
Mariano Anaya 5 years ago
parent 36f79adaf9
commit 18e0f9f533
  1. 8
      src/python/grpcio/grpc/experimental/aio/_call.py
  2. 2
      src/python/grpcio_tests/tests_aio/unit/aio_rpc_error_test.py

@ -67,9 +67,9 @@ class AioRpcError(grpc.RpcError):
def __init__(self,
code: grpc.StatusCode,
initial_metadata: Metadata,
trailing_metadata: Metadata,
details: Optional[str] = None,
initial_metadata: Optional[Metadata] = None,
trailing_metadata: Optional[Metadata] = None,
debug_error_string: Optional[str] = None) -> None:
"""Constructor.
@ -145,10 +145,10 @@ def _create_rpc_error(initial_metadata: Metadata,
status: cygrpc.AioRpcStatus) -> AioRpcError:
return AioRpcError(
_common.CYGRPC_STATUS_CODE_TO_STATUS_CODE[status.code()],
status.details(),
Metadata.from_tuple(initial_metadata),
Metadata.from_tuple(status.trailing_metadata()),
status.debug_error_string(),
details=status.details(),
debug_error_string=status.debug_error_string(),
)

@ -33,9 +33,9 @@ class TestAioRpcError(unittest.TestCase):
def test_attributes(self):
aio_rpc_error = AioRpcError(grpc.StatusCode.CANCELLED,
'details',
initial_metadata=_TEST_INITIAL_METADATA,
trailing_metadata=_TEST_TRAILING_METADATA,
details="details",
debug_error_string=_TEST_DEBUG_ERROR_STRING)
self.assertEqual(aio_rpc_error.code(), grpc.StatusCode.CANCELLED)
self.assertEqual(aio_rpc_error.details(), 'details')

Loading…
Cancel
Save