|
3 | 3 | from dataclasses import dataclass |
4 | 4 | from typing import Any |
5 | 5 |
|
| 6 | +from syrupy import SnapshotAssertion |
| 7 | + |
6 | 8 | from roborock import CleanRecord, CleanSummary, Consumable, DnDTimer, HomeData, S7MaxVStatus, UserData |
7 | 9 | from roborock.b01_containers import ( |
8 | 10 | B01Fault, |
|
20 | 22 | RoborockMopModeS7, |
21 | 23 | RoborockStateCode, |
22 | 24 | ) |
23 | | -from roborock.containers import RoborockBase |
| 25 | +from roborock.containers import MultiMapsList, RoborockBase |
24 | 26 |
|
25 | 27 | from .mock_data import ( |
26 | 28 | CLEAN_RECORD, |
@@ -427,3 +429,55 @@ def test_b01props_deserialization(): |
427 | 429 | assert deserialized.status == WorkStatusMapping.SWEEP_MOPING_2 |
428 | 430 | assert deserialized.wind == SCWindMapping.SUPER_STRONG |
429 | 431 | assert deserialized.net_status.ip == "192.168.1.102" |
| 432 | + |
| 433 | + |
| 434 | +def test_multi_maps_list_info(snapshot: SnapshotAssertion) -> None: |
| 435 | + """Test that MultiMapsListInfo can be deserialized correctly.""" |
| 436 | + data = { |
| 437 | + "max_multi_map": 4, |
| 438 | + "max_bak_map": 1, |
| 439 | + "multi_map_count": 2, |
| 440 | + "map_info": [ |
| 441 | + { |
| 442 | + "mapFlag": 0, |
| 443 | + "add_time": 1757636125, |
| 444 | + "length": 10, |
| 445 | + "name": "Downstairs", |
| 446 | + "bak_maps": [{"mapFlag": 4, "add_time": 1739205442}], |
| 447 | + "rooms": [ |
| 448 | + {"id": 16, "tag": 12, "iot_name_id": "6990322", "iot_name": "Room"}, |
| 449 | + {"id": 17, "tag": 15, "iot_name_id": "7140977", "iot_name": "Room"}, |
| 450 | + {"id": 18, "tag": 12, "iot_name_id": "6985623", "iot_name": "Room"}, |
| 451 | + {"id": 19, "tag": 14, "iot_name_id": "6990378", "iot_name": "Room"}, |
| 452 | + {"id": 20, "tag": 10, "iot_name_id": "7063728", "iot_name": "Room"}, |
| 453 | + {"id": 22, "tag": 12, "iot_name_id": "6995506", "iot_name": "Room"}, |
| 454 | + {"id": 23, "tag": 15, "iot_name_id": "7140979", "iot_name": "Room"}, |
| 455 | + {"id": 25, "tag": 13, "iot_name_id": "6990383", "iot_name": "Room"}, |
| 456 | + {"id": 24, "tag": -1, "iot_name_id": "-1", "iot_name": "Room"}, |
| 457 | + ], |
| 458 | + "furnitures": [ |
| 459 | + {"id": 1, "type": 46, "subtype": 2}, |
| 460 | + {"id": 2, "type": 47, "subtype": 0}, |
| 461 | + {"id": 3, "type": 56, "subtype": 0}, |
| 462 | + {"id": 4, "type": 43, "subtype": 0}, |
| 463 | + {"id": 5, "type": 44, "subtype": 0}, |
| 464 | + {"id": 6, "type": 44, "subtype": 0}, |
| 465 | + {"id": 7, "type": 44, "subtype": 0}, |
| 466 | + {"id": 8, "type": 46, "subtype": 0}, |
| 467 | + {"id": 9, "type": 46, "subtype": 0}, |
| 468 | + ], |
| 469 | + }, |
| 470 | + { |
| 471 | + "mapFlag": 1, |
| 472 | + "add_time": 1734283706, |
| 473 | + "length": 5, |
| 474 | + "name": "Foyer", |
| 475 | + "bak_maps": [{"mapFlag": 5, "add_time": 1728184107}], |
| 476 | + "rooms": [], |
| 477 | + "furnitures": [], |
| 478 | + }, |
| 479 | + ], |
| 480 | + } |
| 481 | + deserialized = MultiMapsList.from_dict(data) |
| 482 | + assert isinstance(deserialized, MultiMapsList) |
| 483 | + assert deserialized == snapshot |
0 commit comments