Download tests/test_catalog.py from tailot/lingologos-thinkingpython: direct link, hf CLI and curl.
- Browser
- Download file 1.52 kB
-
https://huggingface.co/datasets/tailot/lingologos-thinkingpython/resolve/main/tests/test_catalog.py
- Command line
-
hf download hf://datasets/tailot/lingologos-thinkingpython/tests/test_catalog.py
-
curl -L -o test_catalog.py https://huggingface.co/datasets/tailot/lingologos-thinkingpython/resolve/main/tests/test_catalog.py
1.52 kB
| """Every entry in the catalog is verifiable, and the catalog has no undeclared conflict.""" | |
| import os | |
| import sys | |
| import unittest | |
| ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | |
| sys.path.insert(0, ROOT) | |
| from lingologos_thinkingpython import catalog, shapes # noqa: E402 | |
| class CatalogIntegrity(unittest.TestCase): | |
| def setUp(self): | |
| self.entries = catalog.load_entries() | |
| def test_no_defects(self): | |
| self.assertEqual(catalog.integrity(self.entries), []) | |
| def test_every_shape_is_implemented(self): | |
| available = set(shapes.shapes()) | |
| for entry in self.entries: | |
| self.assertIn(entry["shape"], available, entry["id"]) | |
| self.assertIn(entry["id"], shapes.EDITORS, entry["id"]) | |
| self.assertIn(entry["id"], shapes.LOCKS, entry["id"]) | |
| def test_every_pair_between_entries_has_a_policy(self): | |
| policies = catalog.load_policies() | |
| ids = sorted(entry["id"] for entry in self.entries) | |
| for i, first in enumerate(ids): | |
| for second in ids[i + 1:]: | |
| self.assertIsNotNone(catalog.policy_for(policies, first, second), | |
| "%s|%s" % (first, second)) | |
| def test_lock_text_parses(self): | |
| import ast | |
| for entry in self.entries: | |
| text = shapes.lock(entry["id"], {"symbol": "demo", "value": "255", | |
| "param": "value"}) | |
| ast.parse(text) | |
| if __name__ == "__main__": | |
| unittest.main() | |