Skip to content

Commit a572ff8

Browse files
committed
update comments
1 parent 41f1dc4 commit a572ff8

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

tests/system/conftest.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -381,9 +381,8 @@ async def intercept_stream_stream(
381381

382382
@pytest.fixture
383383
def intercepted_echo_grpc(use_mtls):
384-
# The interceptor adds 'showcase-trailer' client metadata. Showcase server
385-
# echoes any metadata with key 'showcase-trailer', so the same metadata
386-
# should appear as trailing metadata in the response.
384+
# The interceptor reads request
385+
# and response metadata.
387386
interceptor = EchoMetadataClientGrpcInterceptor()
388387
host = "localhost:7469"
389388
channel = (
@@ -401,9 +400,8 @@ def intercepted_echo_grpc(use_mtls):
401400

402401
@pytest_asyncio.fixture
403402
async def intercepted_echo_grpc_async():
404-
# The interceptor adds 'showcase-trailer' client metadata. Showcase server
405-
# echoes any metadata with key 'showcase-trailer', so the same metadata
406-
# should appear as trailing metadata in the response.
403+
# The interceptor reads request
404+
# and response metadata.
407405
interceptor = EchoMetadataClientGrpcAsyncInterceptor()
408406
host = "localhost:7469"
409407
channel = grpc.aio.insecure_channel(host, interceptors=[interceptor])

tests/system/test_grpc_interceptor_streams.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
from google import showcase
1616

1717

18-
# intercetped_metadata will be added by the interceptor automatically, and
18+
# `_METADATA` will be sent as part of the request, and the
1919
# showcase server will echo it (since it has key 'showcase-trailer') as trailing
2020
# metadata.
21-
intercepted_metadata = (("showcase-trailer", "intercepted"),)
21+
_METADATA = (("showcase-trailer", "intercepted"),)
2222

2323

2424
def test_unary_stream(intercepted_echo_grpc):
@@ -28,7 +28,7 @@ def test_unary_stream(intercepted_echo_grpc):
2828
{
2929
"content": content,
3030
},
31-
metadata=intercepted_metadata,
31+
metadata=_METADATA,
3232
)
3333

3434
for ground_truth, response in zip(content.split(" "), responses):
@@ -38,7 +38,7 @@ def test_unary_stream(intercepted_echo_grpc):
3838
response_metadata = [
3939
(metadata.key, metadata.value) for metadata in responses.trailing_metadata()
4040
]
41-
assert intercepted_metadata[0] in response_metadata
41+
assert _METADATA[0] in response_metadata
4242
interceptor.response_metadata = response_metadata
4343

4444

@@ -47,13 +47,13 @@ def test_stream_stream(intercepted_echo_grpc):
4747
requests = []
4848
requests.append(showcase.EchoRequest(content="hello"))
4949
requests.append(showcase.EchoRequest(content="world!"))
50-
responses = client.chat(iter(requests), metadata=intercepted_metadata)
50+
responses = client.chat(iter(requests), metadata=_METADATA)
5151

5252
contents = [response.content for response in responses]
5353
assert contents == ["hello", "world!"]
5454

5555
response_metadata = [
5656
(metadata.key, metadata.value) for metadata in responses.trailing_metadata()
5757
]
58-
assert intercepted_metadata[0] in response_metadata
58+
assert _METADATA[0] in response_metadata
5959
interceptor.response_metadata = response_metadata

tests/system/test_streams.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
from google import showcase
2020

2121

22+
# `_METADATA` will be sent as part of the request, and the
23+
# showcase server will echo it (since it has key 'showcase-trailer') as trailing
24+
# metadata.
2225
_METADATA = (("showcase-trailer", "hello world"),)
2326

2427

0 commit comments

Comments
 (0)