Skip to content

Commit e0032f6

Browse files
test: give the Q10 render test helper explicit typed params (mypy)
1 parent a3b095f commit e0032f6

1 file changed

Lines changed: 21 additions & 6 deletions

File tree

tests/map/test_b01_q10_render.py

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,14 @@
1717
B01Q10MapParserConfig,
1818
Q10EraseZone,
1919
Q10HeaderCalibration,
20+
Q10MapPacket,
2021
Q10Point,
2122
parse_map_packet,
2223
)
2324
from roborock.map.b01_q10_overlays import ZONE_TYPE_NO_GO, ZONE_TYPE_NO_MOP, Q10Zone
2425
from roborock.map.b01_q10_render import (
2526
_Q10_RESOLUTIONS,
27+
Q10MapRender,
2628
draw_path_on_map,
2729
render_q10_map,
2830
solve_q10_calibration,
@@ -36,15 +38,28 @@
3638
IDENTITY = GridCalibration(resolution=1.0, origin_x=0.0, origin_y=5.0, y_sign=1)
3739

3840

39-
def _packet():
41+
def _packet() -> Q10MapPacket:
4042
return parse_map_packet(FIXTURE.read_bytes())
4143

4244

43-
def _render(packet=None, **kwargs):
44-
packet = packet if packet is not None else _packet()
45-
args = dict(calibration=None, path=[], robot_position=None, zones=[], virtual_walls=[], config=CONFIG)
46-
args.update(kwargs)
47-
return render_q10_map(packet, **args)
45+
def _render(
46+
packet: Q10MapPacket | None = None,
47+
*,
48+
calibration: GridCalibration | None = None,
49+
path: list[Q10Point] | None = None,
50+
robot_position: Q10Point | None = None,
51+
zones: list[Q10Zone] | None = None,
52+
virtual_walls: list[Q10Zone] | None = None,
53+
) -> Q10MapRender:
54+
return render_q10_map(
55+
packet if packet is not None else _packet(),
56+
calibration=calibration,
57+
path=path or [],
58+
robot_position=robot_position,
59+
zones=zones or [],
60+
virtual_walls=virtual_walls or [],
61+
config=CONFIG,
62+
)
4863

4964

5065
def _floor_world_points(layers, cal: GridCalibration, count: int) -> list[Q10Point]:

0 commit comments

Comments
 (0)