Spaces:
Runtime error
Runtime error
File size: 1,485 Bytes
aad7814 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | """Element-label prefix routing and screenshot regression cases."""
from backend.core.notes_keyword_router import classify_note_cascade
from backend.core.notes_routing import parse_element_label_prefix, route_lines_to_l3_sections
MAIN_ROOF = (
"Main roof: Pitched valley-style roof with imitation slate covering. "
"Some tiles have slipped, lifted, or are laid flat. Valley gutters appear to be in good condition. "
"One ridge tile is broken. Repointing is required and verges are cracked."
)
RAINWATER = (
"Rainwater fittings: UPVC gutters and gullies present. A blockage was noted. "
"The point of discharge is unknown. Front right rainwater downpipe discharges below ground. "
"Some fittings are brittle and faded."
)
def test_element_label_main_roof():
assert parse_element_label_prefix(MAIN_ROOF) == ("D2", MAIN_ROOF)
def test_element_label_rainwater_fittings():
assert parse_element_label_prefix(RAINWATER) == ("D3", RAINWATER)
def test_screenshot_main_roof_routes_d2_not_d3():
sid, score, _ = classify_note_cascade(MAIN_ROOF)
assert sid == "D2"
assert score == 1.0
def test_screenshot_rainwater_routes_d3_not_d4():
sid, score, _ = classify_note_cascade(RAINWATER)
assert sid == "D3"
assert score == 1.0
def test_route_lines_batch():
routed, unmatched = route_lines_to_l3_sections([MAIN_ROOF, RAINWATER])
assert unmatched == []
assert MAIN_ROOF in routed["D2"]
assert RAINWATER in routed["D3"]
|