MEGAINFRA-WEBAPP/scripts/site-model/test_nellmapius.py
DEls 36da7f9f20 feat(site-model): Nellmapius Ext. 25 roads, kerbs and benchmarks from the 100_ROADS and 400_KERBING drawings
Road areas (5,221 m²) in 20 m sections along the ring roads and the Igwali Street spur, 1.74 km of kerb measured once, stand lines, and the four survey benchmarks with an indicative ground plane. No services or ground levels are placed; the supplied survey and sewer sheets cannot yield them.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-21 05:29:17 +02:00

40 lines
1.8 KiB
Python

import json
import math
import unittest
from pathlib import Path
ROOT = Path(__file__).resolve().parents[2] / "reports/site-models/nellmapius-ext-25/2026-10-21"
class Nellmapius(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.road = json.loads((ROOT / "bushveld.json").read_text())
cls.report = json.loads((ROOT / "validation.json").read_text())
def test_area_is_conserved_and_every_section_has_area(self):
total = sum(a["area"] for a in self.road["areas"])
self.assertAlmostEqual(total, self.report["roadAreaM2"], delta=1)
self.assertGreater(total, 5000); self.assertLess(total, 5500)
keys = {s["key"] for s in self.road["sections"]}
self.assertEqual(len(keys), len(self.road["sections"]))
self.assertEqual({a["section"] for a in self.road["areas"]}, keys)
self.assertTrue(all(k["section"] in keys for k in self.road["kerbs"]))
def test_kerbs_are_measured_once(self):
kerb = sum(k["length"] for k in self.road["kerbs"])
self.assertAlmostEqual(kerb, self.report["kerbM"], delta=1)
self.assertGreater(kerb, 1500); self.assertLess(kerb, 2200) # two edges of ~900 m of road
def test_benchmarks_are_real_levels_and_plane_fits_them(self):
self.assertEqual({p["name"] for p in self.road["pegs"]}, {"ST18", "BM3", "ST17", "BM2"})
self.assertLess(max(abs(r) for r in self.report["planeResidualsM"]), 0.25)
def test_no_invented_services_or_levels(self):
s = json.loads((ROOT / "services.json").read_text()); e = json.loads((ROOT / "earthworks.json").read_text())
self.assertEqual(s["stormwater"]["pipes"], []); self.assertEqual(s["sewer"]["manholes"], []); self.assertEqual(e["volumes"], [])
self.assertIn("indicative plane", " ".join(self.road["notes"]).lower())
if __name__ == "__main__":
unittest.main()