Spaces:
Running
Running
Download test/test_brainhealth_wiring.py from SZLHOLDINGS/a11oy: direct link, hf CLI and curl.
- Browser
- Download file 1.83 kB
-
https://huggingface.co/spaces/SZLHOLDINGS/a11oy/resolve/8c8ce77c49f475e64b7bca0a4e373db802d03700/test/test_brainhealth_wiring.py
- Command line
-
hf download hf://spaces/SZLHOLDINGS/a11oy@8c8ce77c49f475e64b7bca0a4e373db802d03700/test/test_brainhealth_wiring.py
-
curl -L -o test_brainhealth_wiring.py https://huggingface.co/spaces/SZLHOLDINGS/a11oy/resolve/8c8ce77c49f475e64b7bca0a4e373db802d03700/test/test_brainhealth_wiring.py
1.83 kB
| from __future__ import annotations | |
| import unittest | |
| import szl_brainhealth as health | |
| class BrainHealthWiringTests(unittest.TestCase): | |
| def test_real_sibling_entrypoints_and_call_styles_are_explicit(self) -> None: | |
| specs = {row["key"]: row for row in health.COMPONENTS} | |
| self.assertEqual(specs["freshness"]["funcs"], ("build_aggregate",)) | |
| self.assertEqual(specs["provenance"]["call_style"], "ns_q_k") | |
| self.assertEqual(specs["contradiction"]["funcs"], ("run_detection",)) | |
| self.assertEqual(specs["uncertainty"]["funcs"], ("handle_uncertainty",)) | |
| def test_uncertainty_is_inverted_to_trust_direction(self) -> None: | |
| payload = health._normalize_component_payload( | |
| "uncertainty", | |
| {"label": "MODELED", "verdict": "HIGHLY-UNCERTAIN", "uncertainty": 0.91, "abstain_recommended": True}, | |
| ) | |
| self.assertEqual(payload["trust_value"], 0.09) | |
| self.assertTrue(payload["abstain"]) | |
| def test_descriptive_prose_does_not_create_a_false_adverse_signal(self) -> None: | |
| payload = { | |
| "label": "MODELED", | |
| "verdict": "WEAK-GROUNDING", | |
| "should_abstain": False, | |
| "note": "the system abstains only when evidence is insufficient", | |
| } | |
| self.assertIsNone(health._detect_adverse(payload, ("ungrounded",))) | |
| def test_freshness_uses_real_node_distribution(self) -> None: | |
| payload = health._normalize_component_payload( | |
| "freshness", | |
| {"label": "MEASURED", "node_count": 100, "verdict_counts": {"FRESH": 5, "AGING": 15, "STALE": 80}}, | |
| ) | |
| self.assertEqual(payload["trust_value"], 0.2) | |
| self.assertTrue(payload["stale_dominant"]) | |
| self.assertEqual(payload["verdict"], "STALE-DOMINANT") | |
| if __name__ == "__main__": | |
| unittest.main() | |