Spaces:
Running
Running
Download test/test_atlas_registry_alignment.py from SZLHOLDINGS/a11oy: direct link, hf CLI and curl.
- Browser
- Download file 3.32 kB
-
https://huggingface.co/spaces/SZLHOLDINGS/a11oy/resolve/8c8ce77c49f475e64b7bca0a4e373db802d03700/test/test_atlas_registry_alignment.py
- Command line
-
hf download hf://spaces/SZLHOLDINGS/a11oy@8c8ce77c49f475e64b7bca0a4e373db802d03700/test/test_atlas_registry_alignment.py
-
curl -L -o test_atlas_registry_alignment.py https://huggingface.co/spaces/SZLHOLDINGS/a11oy/resolve/8c8ce77c49f475e64b7bca0a4e373db802d03700/test/test_atlas_registry_alignment.py
3.32 kB
| """Regression tests for the canonical Atlas roster and brain-trust lens.""" | |
| from __future__ import annotations | |
| import re | |
| import unittest | |
| from pathlib import Path | |
| import szl3d_holographic | |
| import szl_kc_atlas | |
| class AtlasRegistryAlignmentTests(unittest.TestCase): | |
| def setUp(self) -> None: | |
| self.map = szl_kc_atlas.atlas_map(seed=42) | |
| def test_denominator_is_the_canonical_shell_registry(self) -> None: | |
| shell_ids = [row["id"] for row in szl3d_holographic.SURFACES] | |
| atlas_ids = [ | |
| row["id"] | |
| for cluster in self.map["clusters"] | |
| for row in cluster["surfaces"] | |
| ] | |
| self.assertEqual(self.map["registry"]["source"], "szl3d_holographic.SURFACES") | |
| self.assertTrue(self.map["registry"]["loaded"]) | |
| self.assertEqual(self.map["surface_count"], len(shell_ids)) | |
| self.assertCountEqual(atlas_ids, shell_ids) | |
| self.assertEqual(len(atlas_ids), len(set(atlas_ids))) | |
| def test_coverage_cannot_hide_roster_drift(self) -> None: | |
| self.assertEqual(self.map["coverage_denominator"], "szl3d_holographic.SURFACES") | |
| self.assertEqual(self.map["total_classified"], self.map["surface_count"]) | |
| self.assertEqual(self.map["coverage"], 1.0) | |
| self.assertEqual(self.map["orphans"], []) | |
| self.assertEqual(self.map["unknown_assignments"], []) | |
| self.assertEqual(self.map["double_counts"], []) | |
| self.assertRegex(self.map["registry"]["sha256"], r"^[0-9a-f]{64}$") | |
| def test_atlas_is_included_and_unclaimed_labels_stay_unspecified(self) -> None: | |
| by_id = { | |
| row["id"]: row | |
| for cluster in self.map["clusters"] | |
| for row in cluster["surfaces"] | |
| } | |
| self.assertIn("atlas", by_id) | |
| self.assertTrue(self.map["atlas_membership"]["included_in_surface_count"]) | |
| self.assertEqual(by_id["atlas"]["label"], "MODELED") | |
| # `circuits` was added after the embedded Wave-27 label snapshot and its canonical | |
| # title makes no maturity claim. The Atlas must not silently promote it. | |
| self.assertEqual(by_id["circuits"]["label"], "UNSPECIFIED") | |
| def test_brain_lens_is_read_only_and_reproducible_in_the_surface(self) -> None: | |
| js = (Path(__file__).parents[1] / "static" / "3d" / "surfaces" / "atlas.js").read_text(encoding="utf-8") | |
| self.assertIn("/api/a11oy/v1/brain/health", js) | |
| self.assertIn("/api/a11oy/v1/brain/gaps", js) | |
| self.assertIn("brain/health?q=", js) | |
| self.assertIn("brain/gaps?q=", js) | |
| self.assertIn("Purpose · Try · Evidence · Limits · Reproduce", js) | |
| self.assertIn("no memory write, no model call, no action", js) | |
| self.assertNotRegex(js, re.compile(r"fetch\([^\n]+method\s*:\s*[\"']POST", re.I)) | |
| def test_registry_module_aliases_resolve(self) -> None: | |
| surface_dir = Path(__file__).parents[1] / "static" / "3d" / "surfaces" | |
| for surface in szl3d_holographic.SURFACES: | |
| module_id = surface.get("module", surface["id"]) | |
| self.assertTrue((surface_dir / (module_id + ".js")).is_file(), surface["id"]) | |
| markets = next(row for row in szl3d_holographic.SURFACES if row["id"] == "markets") | |
| self.assertEqual(markets["module"], "finance") | |
| if __name__ == "__main__": | |
| unittest.main() | |