Skip to content

Commit

Permalink
fix review
Browse files Browse the repository at this point in the history
  • Loading branch information
dimastbk committed May 15, 2024
1 parent 915ca93 commit 390072f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 6 additions & 0 deletions aiokafka/protocol/fetch.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from typing import List, Optional, Tuple

from .api import Request, Response
from .types import Array, Bytes, Int8, Int16, Int32, Int64, Schema, String

Expand All @@ -23,6 +25,8 @@ class FetchResponse_v0(Response):
)
)

topics: Optional[List[Tuple[str, List[Tuple[int, int, int, bytes]]]]]


class FetchResponse_v1(Response):
API_KEY = 1
Expand Down Expand Up @@ -235,6 +239,8 @@ class FetchRequest_v0(Request):
),
)

min_bytes: Optional[int]


class FetchRequest_v1(Request):
API_KEY = 1
Expand Down
7 changes: 4 additions & 3 deletions tests/test_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,9 @@ def test_decode_fetch_response_partial() -> None:
]
)
resp = FetchResponse_v0.decode(io.BytesIO(encoded))
assert len(resp.topics) == 1 # type: ignore[attr-defined]
topic, partitions = resp.topics[0] # type: ignore[attr-defined]
assert resp.topics is not None
assert len(resp.topics) == 1
topic, partitions = resp.topics[0]
assert topic == "foobar"
assert len(partitions) == 2

Expand All @@ -303,7 +304,7 @@ def test_struct_unrecognized_kwargs() -> None:

def test_struct_missing_kwargs() -> None:
fr = FetchRequest_v0(max_wait_time=100)
assert fr.min_bytes is None # type: ignore[attr-defined]
assert fr.min_bytes is None


def test_unsigned_varint_serde() -> None:
Expand Down

0 comments on commit 390072f

Please sign in to comment.