| import unittest | |
| from src.evidence import evidence_to_markdown_table, make_evidence | |
| class EvidenceTests(unittest.TestCase): | |
| def test_make_evidence_assigns_id_and_fields(self): | |
| item = make_evidence( | |
| category="Climate", | |
| finding="Recent historical rainfall data was retrieved.", | |
| source_name="Open-Meteo", | |
| source_url="https://open-meteo.com/", | |
| source_type="public API", | |
| resolution_or_scope="anchor coordinate", | |
| confidence="medium", | |
| limitation="Modelled/reanalysis data, not on-site measurement.", | |
| design_implication="Use for preliminary drainage thinking.", | |
| verification_needed="Check waterlogging during site visit.", | |
| output_label="public_data", | |
| ) | |
| self.assertTrue(item.id.startswith("E")) | |
| self.assertEqual(item.confidence, "medium") | |
| self.assertEqual(item.output_label, "public_data") | |
| def test_evidence_table_contains_limitation(self): | |
| row = make_evidence( | |
| category="Boundary", | |
| finding="Drawn boundary created by user.", | |
| source_name="User input", | |
| source_url="", | |
| source_type="drawn map", | |
| resolution_or_scope="approximate", | |
| confidence="low", | |
| limitation="Drawn boundaries are approximate.", | |
| design_implication="Use for early studio context only.", | |
| verification_needed="Verify with CAD/KML/GeoJSON or survey.", | |
| output_label="user_input", | |
| ) | |
| table = evidence_to_markdown_table([row]) | |
| self.assertIn("Drawn boundaries are approximate", table) | |
| self.assertIn("Verify with CAD", table) | |
| if __name__ == "__main__": | |
| unittest.main() | |