]> git.ipfire.org Git - thirdparty/google/fonts.git/commitdiff
.ci/test_font_tags: Add check to ensure there are no tags for unkown families 10288/head
authorMarc Foley <m.foley.88@gmail.com>
Fri, 27 Feb 2026 15:15:37 +0000 (15:15 +0000)
committerMarc Foley <m.foley.88@gmail.com>
Fri, 27 Feb 2026 15:15:37 +0000 (15:15 +0000)
.ci/test_font_tags.py

index a9731b5f9a83f3dff0b92a5426df2f027c8db36e..fb980290ccfaf002bc1e4bd1eaada5975357df6c 100644 (file)
@@ -12,6 +12,14 @@ def family_metadata():
     return data["familyMetadataList"]
 
 
+@pytest.fixture
+def sb_family_metadata():
+    data = json.loads(
+        urlopen("https://fonts.sandbox.google.com/metadata/fonts").read().decode("utf-8")
+    )
+    return data["familyMetadataList"]
+
+
 @pytest.fixture
 def family_tags():
     fp = os.path.join(os.path.dirname(__file__), "..", "tags", "all", "families.csv")
@@ -81,3 +89,14 @@ def test_tag_vals_in_range(family_tags):
         if val <= 0 or val > 100:
             out_of_range.append((family, cat, val))
     assert not out_of_range, f"Values out of range 1-100: {out_of_range}"
+
+
+def test_tags_for_unknown_families(family_tags, sb_family_metadata):
+    """Families that are tagged but not in the sandbox metadata are likely
+    typos or old families that have been removed. These should be removed from
+    the tags file.
+    """
+    sb_families = set(f["family"] for f in sb_family_metadata)
+    tagged_families = set(f[0] for f in family_tags)
+    unknown_families = sorted(tagged_families - sb_families)
+    assert not unknown_families, f"Unknown families found: {unknown_families}"
\ No newline at end of file