diff --git a/tests/domain/magicplan/test_mapper.py b/tests/domain/magicplan/test_mapper.py index 29492662..419a66fc 100644 --- a/tests/domain/magicplan/test_mapper.py +++ b/tests/domain/magicplan/test_mapper.py @@ -93,12 +93,6 @@ def test_window_fields_are_floats(plan: Plan) -> None: assert isinstance(window.area_m2, float) -def test_window_opening_type_prefix_stripped(plan: Plan) -> None: - window = plan.floors[0].rooms[0].windows[0] - assert not window.opening_type.startswith("window") - assert window.opening_type == "casement" - - def test_window_area_is_width_times_height(plan: Plan) -> None: window = plan.floors[0].rooms[0].windows[0] assert window.area_m2 == round(window.width_m * window.height_m, 2) @@ -117,12 +111,6 @@ def test_hallway_has_no_windows(plan: Plan) -> None: assert hallway.windows == [] -def test_floor1_window_opening_type_awning(plan: Plan) -> None: - bedroom1 = plan.floors[1].rooms[0] - assert bedroom1.name == "Bedroom 1" - assert bedroom1.windows[0].opening_type == "awning" - - # --- Doors --- @@ -163,6 +151,20 @@ def test_window_with_no_custom_fields_has_no_ventilation() -> None: assert window.ventilation is None +def test_mapped_window_has_no_opening_type() -> None: + wi = WallItem( + uid="test", + symbol=Symbol(id="windowcasement", name="Casement Window", valid=True), + size=Vec3(x=1.0, y=0.0, z=1.2), + position=Vec3(x=0.0, y=0.0, z=0.0), + rotation=Vec3(x=0.0, y=0.0, z=0.0), + ) + + window = _map_window(wi) + + assert not hasattr(window, "opening_type") + + def test_kitchen_window_has_ventilation(plan: Plan) -> None: window = plan.floors[0].rooms[0].windows[0] @@ -181,12 +183,18 @@ def test_toilet_door_has_ventilation_undercut(plan: Plan) -> None: def test_doorglass_is_classified_as_window(plan: Plan) -> None: room = plan.floors[0].rooms[1] - assert "doorglass" in [w.opening_type for w in room.windows] + assert any( + w.ventilation is not None and w.ventilation.opening_type == "External.Door" + for w in room.windows + ) def test_glass_door_ventilation_opening_type(plan: Plan) -> None: room = plan.floors[0].rooms[1] - glass = next(w for w in room.windows if w.opening_type == "doorglass") + glass = next( + w for w in room.windows + if w.ventilation is not None and w.ventilation.opening_type == "External.Door" + ) assert glass.ventilation is not None assert glass.ventilation.opening_type == "External.Door" diff --git a/tests/repositories/magic_plan/test_magic_plan_postgres_repository.py b/tests/repositories/magic_plan/test_magic_plan_postgres_repository.py index a3ac828f..4aaca0bf 100644 --- a/tests/repositories/magic_plan/test_magic_plan_postgres_repository.py +++ b/tests/repositories/magic_plan/test_magic_plan_postgres_repository.py @@ -31,7 +31,6 @@ def _plan() -> Plan: width_m=1.2, height_m=1.5, area_m2=1.8, - opening_type="casement", ventilation=WindowVentilation( opening_type="30.Hinged.Pivot.Window", num_openings=2,