Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
d1e096b13f
|
|||
|
81b70123bf
|
|||
|
e5af931c0a
|
+1864
-16
File diff suppressed because it is too large
Load Diff
@@ -489,5 +489,29 @@ class TestAnkiBuild(unittest.TestCase):
|
|||||||
self.assertEqual(first.read_bytes(), second.read_bytes(), first.name)
|
self.assertEqual(first.read_bytes(), second.read_bytes(), first.name)
|
||||||
|
|
||||||
|
|
||||||
|
class TestRealExplanationsFile(unittest.TestCase):
|
||||||
|
"""Validate the repo's actual explanations.json against the live catalog.
|
||||||
|
|
||||||
|
The other tests are hermetic by design: they exercise the schema
|
||||||
|
validator on synthetic fixtures so the validator's own logic is
|
||||||
|
tested without coupling to editorial data. That leaves a gap — a
|
||||||
|
real malformed entry or stale key in the repo's explanations.json
|
||||||
|
would not show up in `python3 -m unittest`. This test closes it
|
||||||
|
when the fetched catalog is present, and skips otherwise so an
|
||||||
|
unfetched checkout still runs the rest of the suite.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def test_repo_explanations_pass_schema_and_match_catalog(self):
|
||||||
|
repo = Path(__file__).resolve().parent
|
||||||
|
explanations_path = repo / "explanations.json"
|
||||||
|
catalogs = sorted((repo / "data").glob("*/fragenkatalog*.json"))
|
||||||
|
if not explanations_path.exists() or not catalogs:
|
||||||
|
self.skipTest("explanations.json or fetched catalog not available")
|
||||||
|
explanations = aa.load_explanations(explanations_path)
|
||||||
|
catalog = json.loads(catalogs[-1].read_text("utf-8"))
|
||||||
|
categories = aa.collect_categories(catalog)
|
||||||
|
aa._check_explanation_keys_against_catalog(explanations, categories)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|||||||
Reference in New Issue
Block a user