Spaces:
Runtime error
Runtime error
| from backend.core.notes_keyword_router import classify_note_cascade | |
| from backend.core.notes_routing import parse_explicit_section_prefix | |
| def test_explicit_prefix_comma(): | |
| assert parse_explicit_section_prefix("G1, garage roof pitched design") == ( | |
| "G1", | |
| "garage roof pitched design", | |
| ) | |
| def test_explicit_prefix_colon(): | |
| assert parse_explicit_section_prefix("D9: External walls with step cracking") == ( | |
| "D9", | |
| "External walls with step cracking", | |
| ) | |
| def test_explicit_prefix_dash(): | |
| assert parse_explicit_section_prefix("D4 - cavity wall with render loss") == ( | |
| "D4", | |
| "cavity wall with render loss", | |
| ) | |
| def test_cascade_external_walls_routes_d4(): | |
| sid, score, body = classify_note_cascade( | |
| "External walls: 300mm cavity wall construction with step cracking" | |
| ) | |
| assert sid == "D4" | |
| assert score == 1.0 | |
| assert "cavity wall" in body.lower() | |
| def test_cascade_rainwater_routes_d3_not_d4(): | |
| sid, _, _ = classify_note_cascade( | |
| "Rainwater fittings: UPVC gutters and gullies present. Rainwater downpipe discharges below ground." | |
| ) | |
| assert sid == "D3" | |
| def test_cascade_g1_prefix_strips_and_routes_g1(): | |
| sid, score, body = classify_note_cascade("G1, garage roof pitched design with concrete tiles") | |
| assert sid == "G1" | |
| assert score == 1.0 | |
| assert body == "garage roof pitched design with concrete tiles" | |
| assert not body.upper().startswith("G1") | |
| def test_cascade_g1_garage_roof_not_d2(): | |
| sid, _, _ = classify_note_cascade("Garage roof pitched design with concrete tiles") | |
| assert sid == "G1" | |