mosaic-headless 1.36.2 → 1.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/SKILL.md +179 -1119
- package/assets/templates/platforms/claude-ai.json +6 -3
- package/assets/templates/platforms/claude-code.json +10 -4
- package/assets/templates/platforms/codex-cli.json +6 -3
- package/assets/templates/platforms/continue.json +1 -1
- package/assets/templates/platforms/copilot.json +6 -3
- package/assets/templates/platforms/cursor.json +1 -1
- package/assets/templates/platforms/gemini-cli.json +6 -3
- package/data/pending.csv +8 -0
- package/data/terms-zh.csv +97 -0
- package/evals/RESULTS.md +41 -0
- package/evals/cases.json +329 -0
- package/evals/grade.py +121 -0
- package/evals/runs/2026-11-16-final-with-skill.json +29 -0
- package/evals/runs/2026-11-16-final-without-skill.json +30 -0
- package/evals/runs/2026-11-16-r1-with-skill.json +19 -0
- package/evals/runs/2026-11-16-r1-without-skill.json +19 -0
- package/evals/runs/2026-11-16-r2-with-skill.json +9 -0
- package/evals/runs/2026-11-16-r2-without-skill.json +9 -0
- package/evals/runs/2026-11-16-r3-without-skill.json +1 -0
- package/package.json +1 -1
- package/references/building.md +93 -0
- package/references/core-rules.md +143 -0
- package/references/data-files.md +102 -0
- package/references/design-system.md +1 -1
- package/references/facts.md +261 -0
- package/references/failure-modes.md +1 -1
- package/references/maintenance.md +70 -0
- package/references/tools.md +84 -0
- package/references/tutorials.md +1 -1
- package/references/upgrading.md +2 -2
- package/references/verification-record.md +395 -0
- package/scripts/check-release.mjs +15 -7
- package/scripts/install.mjs +35 -14
- package/scripts/sync-version.mjs +5 -3
- package/tools/check_numbers.py +196 -0
- package/tools/mo.py +132 -7
- package/tools/test_mosaic.py +373 -0
- package/tools/verify_menus.py +1 -1
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""test_mosaic.py - offline self-test for the skill (skill SOP item 8).
|
|
3
|
+
|
|
4
|
+
python tools/test_mosaic.py # exit 1 on any failure
|
|
5
|
+
|
|
6
|
+
No network, no site, no third-party packages. Covers:
|
|
7
|
+
- mo.py: the front door answers, exits 1 on unsafe / unknown, Chinese terms resolve
|
|
8
|
+
- data/terms-zh.csv: every row sourced, every English target exists in the data
|
|
9
|
+
- build_page: a spec flattens to the editor's shape and unsafe input is refused
|
|
10
|
+
- build_page / build_site: the public signatures em925 imports are unchanged
|
|
11
|
+
- SKILL.md: size, fixed headings, every number claimed (check_numbers), links resolve
|
|
12
|
+
- references/data-files.md: every row count matches its CSV
|
|
13
|
+
- data/pending.csv exists with its columns
|
|
14
|
+
|
|
15
|
+
The browser verifiers (tools/verify_*.py) need a live site and playwright and are
|
|
16
|
+
not run here; see SKILL.md ## Verify.
|
|
17
|
+
"""
|
|
18
|
+
from __future__ import annotations
|
|
19
|
+
|
|
20
|
+
import csv
|
|
21
|
+
import inspect
|
|
22
|
+
import json
|
|
23
|
+
import os
|
|
24
|
+
import re
|
|
25
|
+
import subprocess
|
|
26
|
+
import sys
|
|
27
|
+
import unittest
|
|
28
|
+
|
|
29
|
+
HERE = os.path.dirname(os.path.abspath(__file__))
|
|
30
|
+
ROOT = os.path.dirname(HERE)
|
|
31
|
+
DATA = os.path.join(ROOT, "data")
|
|
32
|
+
sys.path.insert(0, HERE)
|
|
33
|
+
|
|
34
|
+
for _s in (sys.stdout, sys.stderr):
|
|
35
|
+
if hasattr(_s, "reconfigure"):
|
|
36
|
+
_s.reconfigure(encoding="utf-8", errors="replace")
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def mo(*args):
|
|
40
|
+
r = subprocess.run([sys.executable, os.path.join(HERE, "mo.py"), *args],
|
|
41
|
+
capture_output=True, text=True, encoding="utf-8")
|
|
42
|
+
return r.returncode, r.stdout + r.stderr
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def rows(name):
|
|
46
|
+
with open(os.path.join(DATA, name), encoding="utf-8", newline="") as fh:
|
|
47
|
+
return list(csv.DictReader(fh))
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def read(rel):
|
|
51
|
+
with open(os.path.join(ROOT, rel), encoding="utf-8") as fh:
|
|
52
|
+
return fh.read()
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class MoQueries(unittest.TestCase):
|
|
56
|
+
def test_stats(self):
|
|
57
|
+
code, out = mo("--json", "stats")
|
|
58
|
+
self.assertEqual(code, 0, out)
|
|
59
|
+
s = json.loads(out)
|
|
60
|
+
self.assertEqual(s["node_types"], len(rows("node-types.csv")))
|
|
61
|
+
self.assertEqual(s["node_property_declarations"], len(rows("node-properties.csv")))
|
|
62
|
+
self.assertEqual(s["node_properties"], len(rows("node-property-verification.csv")))
|
|
63
|
+
self.assertIn("accordion-content", s["unsafe_types"])
|
|
64
|
+
|
|
65
|
+
def test_stats_explains_declared_vs_probed(self):
|
|
66
|
+
code, out = mo("stats")
|
|
67
|
+
self.assertEqual(code, 0)
|
|
68
|
+
self.assertIn("declared once per owning data class", out)
|
|
69
|
+
|
|
70
|
+
def test_type_leads_with_verdict(self):
|
|
71
|
+
code, out = mo("--json", "type", "accordion-content")
|
|
72
|
+
self.assertEqual(code, 0, out)
|
|
73
|
+
rec = json.loads(out)
|
|
74
|
+
self.assertEqual(rec["outcome"], "BROKE_PAGE")
|
|
75
|
+
self.assertFalse(rec["safe_to_commit"])
|
|
76
|
+
|
|
77
|
+
def test_check_exit_codes(self):
|
|
78
|
+
self.assertEqual(mo("check", "div", "text", "button")[0], 0)
|
|
79
|
+
self.assertEqual(mo("check", "accordion-content")[0], 1)
|
|
80
|
+
self.assertNotEqual(mo("check", "no-such-type")[0], 0)
|
|
81
|
+
|
|
82
|
+
def test_select_split_1012(self):
|
|
83
|
+
code, out = mo("--json", "placement", "select")
|
|
84
|
+
self.assertEqual(code, 0, out)
|
|
85
|
+
self.assertNotIn("select-input", {r["type"] for r in rows("node-types.csv")})
|
|
86
|
+
|
|
87
|
+
def test_css_reverse_lookup(self):
|
|
88
|
+
code, out = mo("css", "border-radius")
|
|
89
|
+
self.assertEqual(code, 0)
|
|
90
|
+
self.assertIn("borderRadius", out)
|
|
91
|
+
|
|
92
|
+
def test_params(self):
|
|
93
|
+
code, out = mo("--json", "params", "text")
|
|
94
|
+
self.assertEqual(code, 0, out)
|
|
95
|
+
self.assertEqual(json.loads(out)["type"], "text")
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
class ChineseTerms(unittest.TestCase):
|
|
99
|
+
def test_css_padding_in_chinese(self):
|
|
100
|
+
code, out = mo("css", "內距")
|
|
101
|
+
self.assertEqual(code, 0, out)
|
|
102
|
+
for p in ("paddingTop", "paddingRight", "paddingBottom", "paddingLeft"):
|
|
103
|
+
self.assertIn(p, out)
|
|
104
|
+
|
|
105
|
+
def test_shipped_and_designer_terms_agree(self):
|
|
106
|
+
self.assertEqual(mo("css", "內距")[1], mo("css", "邊框間距")[1])
|
|
107
|
+
self.assertEqual(mo("css", "外距")[1], mo("css", "邊界")[1])
|
|
108
|
+
|
|
109
|
+
def test_state_hover(self):
|
|
110
|
+
code, out = mo("states", "--grep", "懸停")
|
|
111
|
+
self.assertEqual(code, 0)
|
|
112
|
+
self.assertIn("hover", out)
|
|
113
|
+
|
|
114
|
+
def test_type_by_chinese_name(self):
|
|
115
|
+
code, out = mo("--json", "type", "摺疊面板")
|
|
116
|
+
self.assertEqual(code, 0, out)
|
|
117
|
+
self.assertEqual(json.loads(out)["type"], "accordion")
|
|
118
|
+
|
|
119
|
+
def test_ambiguous_type_refused(self):
|
|
120
|
+
code, out = mo("type", "彈窗")
|
|
121
|
+
self.assertNotEqual(code, 0)
|
|
122
|
+
self.assertIn("modal", out)
|
|
123
|
+
|
|
124
|
+
def test_unmapped_word_points_at_pending(self):
|
|
125
|
+
code, out = mo("css", "完全沒有這個詞")
|
|
126
|
+
self.assertEqual(code, 1)
|
|
127
|
+
self.assertIn("pending.csv", out)
|
|
128
|
+
|
|
129
|
+
def test_wrong_kind_says_so(self):
|
|
130
|
+
code, out = mo("css", "按鈕")
|
|
131
|
+
self.assertEqual(code, 1)
|
|
132
|
+
self.assertIn("type term", out)
|
|
133
|
+
|
|
134
|
+
def test_terms_command(self):
|
|
135
|
+
code, out = mo("--json", "terms", "斷點")
|
|
136
|
+
self.assertEqual(code, 0, out)
|
|
137
|
+
self.assertEqual(json.loads(out)[0]["en"], "breakpoint")
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
class TermsTable(unittest.TestCase):
|
|
141
|
+
TRUST = {"measured", "documented", "inferred", "house-style"}
|
|
142
|
+
|
|
143
|
+
@classmethod
|
|
144
|
+
def setUpClass(cls):
|
|
145
|
+
cls.terms = rows("terms-zh.csv")
|
|
146
|
+
cls.types = {r["type"] for r in rows("node-types.csv")}
|
|
147
|
+
cls.states = [r["state"] for r in rows("style-states.csv")]
|
|
148
|
+
cls.css = [(r["css_property"] + " " + r["property"]).lower()
|
|
149
|
+
for r in rows("style-verification.csv")]
|
|
150
|
+
|
|
151
|
+
def test_columns_and_provenance(self):
|
|
152
|
+
for r in self.terms:
|
|
153
|
+
self.assertEqual(set(r), {"zh", "en", "kind", "note", "source", "trust"}, r)
|
|
154
|
+
self.assertTrue(r["zh"] and r["en"] and r["source"], r)
|
|
155
|
+
self.assertIn(r["trust"], self.TRUST, r)
|
|
156
|
+
self.assertIn(r["kind"], {"css", "type", "state", "concept"}, r)
|
|
157
|
+
|
|
158
|
+
def test_no_duplicate_words(self):
|
|
159
|
+
zh = [r["zh"] for r in self.terms]
|
|
160
|
+
self.assertEqual(len(zh), len(set(zh)))
|
|
161
|
+
|
|
162
|
+
def test_every_target_exists(self):
|
|
163
|
+
for r in self.terms:
|
|
164
|
+
for en in r["en"].split("|"):
|
|
165
|
+
if r["kind"] == "type":
|
|
166
|
+
self.assertIn(en, self.types, r["zh"])
|
|
167
|
+
elif r["kind"] == "state":
|
|
168
|
+
self.assertTrue(any(en in s for s in self.states), r["zh"])
|
|
169
|
+
elif r["kind"] == "css":
|
|
170
|
+
self.assertTrue(any(en in c for c in self.css), r["zh"])
|
|
171
|
+
|
|
172
|
+
def test_designer_glossary_present(self):
|
|
173
|
+
by = {r["zh"]: r for r in self.terms}
|
|
174
|
+
for zh, en in (("內距", "padding"), ("外距", "margin"), ("懸停", "hover"), ("斷點", "breakpoint")):
|
|
175
|
+
self.assertEqual(by[zh]["en"], en)
|
|
176
|
+
self.assertEqual(by[zh]["trust"], "house-style")
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
class BuildPageOffline(unittest.TestCase):
|
|
180
|
+
@classmethod
|
|
181
|
+
def setUpClass(cls):
|
|
182
|
+
import build_page
|
|
183
|
+
cls.bp = build_page
|
|
184
|
+
cls.surface = build_page.Surface()
|
|
185
|
+
build_page.VAR_IDS["--ink"] = "11111111-1111-1111-1111-111111111111"
|
|
186
|
+
|
|
187
|
+
def flat(self, tree):
|
|
188
|
+
return self.bp.flatten(self.bp.refresh_node_ids(tree), "BODY", "MASTER",
|
|
189
|
+
self.surface, False, parent_type="body")
|
|
190
|
+
|
|
191
|
+
def skeleton_tree(self):
|
|
192
|
+
code, out = mo("skeleton")
|
|
193
|
+
self.assertEqual(code, 0)
|
|
194
|
+
return json.loads(out)["pages"][0]["tree"]
|
|
195
|
+
|
|
196
|
+
def test_skeleton_flattens(self):
|
|
197
|
+
recs = self.flat(self.skeleton_tree())
|
|
198
|
+
self.assertEqual([r["type"] for r in recs], ["div", "text", "wysiwyg-text"])
|
|
199
|
+
for r in recs:
|
|
200
|
+
self.assertEqual(r["documentType"], "master")
|
|
201
|
+
self.assertEqual(r["documentID"], "MASTER")
|
|
202
|
+
self.assertIsInstance(r["ordering"], str) # fractional index, never a number
|
|
203
|
+
self.assertEqual(recs[0]["parentID"], "BODY")
|
|
204
|
+
self.assertEqual(recs[1]["parentID"], recs[0]["ID"])
|
|
205
|
+
style = recs[1]["data"]["style"]["states"]["&"]
|
|
206
|
+
self.assertEqual(style["_"]["color"], {"var": "11111111-1111-1111-1111-111111111111"})
|
|
207
|
+
self.assertIn("_m", style)
|
|
208
|
+
|
|
209
|
+
def test_button_text_wrapped_like_the_editor(self):
|
|
210
|
+
recs = self.flat({"type": "div", "children": [
|
|
211
|
+
{"type": "button", "data": {"url": {"v": "/contact/"}}, "text": "Go"}]})
|
|
212
|
+
types = [r["type"] for r in recs]
|
|
213
|
+
self.assertEqual(types, ["div", "button", "text", "wysiwyg-text"])
|
|
214
|
+
self.assertEqual(recs[2]["data"]["style"]["variant"], self.bp.INHERITED_TEXT_VARIANT)
|
|
215
|
+
self.assertEqual(recs[3]["parentID"], recs[2]["ID"])
|
|
216
|
+
|
|
217
|
+
def test_sibling_ordering(self):
|
|
218
|
+
recs = self.flat({"type": "div", "children": [{"type": "div"}, {"type": "div"}, {"type": "div"}]})
|
|
219
|
+
self.assertEqual([r["ordering"] for r in recs[1:]], ["a0", "a1", "a2"])
|
|
220
|
+
|
|
221
|
+
def test_pinned_ids_are_refreshed(self):
|
|
222
|
+
tree = {"type": "div", "nodeID": "pin-a", "children": [{"type": "div", "nodeID": "pin-b"}]}
|
|
223
|
+
a = self.flat(json.loads(json.dumps(tree)))
|
|
224
|
+
b = self.flat(json.loads(json.dumps(tree)))
|
|
225
|
+
self.assertNotEqual(a[0]["ID"], "pin-a")
|
|
226
|
+
self.assertNotEqual(a[0]["ID"], b[0]["ID"])
|
|
227
|
+
|
|
228
|
+
def assertRefused(self, tree, needle):
|
|
229
|
+
with self.assertRaises(SystemExit) as cm:
|
|
230
|
+
self.flat(tree)
|
|
231
|
+
self.assertIn(needle, str(cm.exception))
|
|
232
|
+
|
|
233
|
+
def test_refuses_unsafe_placement(self):
|
|
234
|
+
self.assertRefused({"type": "div", "children": [{"type": "accordion-content"}]}, "BROKE_PAGE")
|
|
235
|
+
|
|
236
|
+
def test_refuses_unknown_type(self):
|
|
237
|
+
self.assertRefused({"type": "nosuch"}, "unknown node type")
|
|
238
|
+
|
|
239
|
+
def test_refuses_unknown_style_key(self):
|
|
240
|
+
self.assertRefused({"type": "div", "style": {"&": {"_": {"noSuchProp": "1"}}}}, "not a supported style property")
|
|
241
|
+
|
|
242
|
+
def test_refuses_out_of_enum(self):
|
|
243
|
+
self.assertRefused({"type": "div", "style": {"&": {"_": {"whiteSpace": "pre-line"}}}}, "pre-line")
|
|
244
|
+
|
|
245
|
+
def test_refuses_media_without_space(self):
|
|
246
|
+
self.assertRefused({"type": "code", "data": {"content": "@media(max-width:1px){}"}}, "@media(")
|
|
247
|
+
|
|
248
|
+
def test_refuses_tags_in_text_run(self):
|
|
249
|
+
self.assertRefused({"type": "text", "text": "a<b>c</b>"}, "<b>")
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
class PublicInterface(unittest.TestCase):
|
|
253
|
+
"""em925's deploy tool imports build_page and build_site from the global
|
|
254
|
+
install. Their names and parameters are a contract: change one and this fails."""
|
|
255
|
+
|
|
256
|
+
EXPECTED = {
|
|
257
|
+
"build_page": {
|
|
258
|
+
"build": "(client, cfg, spec, force)",
|
|
259
|
+
"flatten": "(node, parent_id, master_id, surface, force, ordering='a0', parent_type=None, out=None, ancestors=())",
|
|
260
|
+
"refresh_node_ids": "(tree)",
|
|
261
|
+
"wrap_text_runs": "(node_type, children)",
|
|
262
|
+
"to_style": "(spec_style)",
|
|
263
|
+
"expand_shorthands": "(props)",
|
|
264
|
+
"theme_records": "(spec, doc, surface)",
|
|
265
|
+
"create_master": "(client, name)",
|
|
266
|
+
"bind_template": "(client, cfg, master_id, page_id)",
|
|
267
|
+
"ordering_for": "(index)",
|
|
268
|
+
"load_csv": "(name)",
|
|
269
|
+
},
|
|
270
|
+
"build_site": {
|
|
271
|
+
"main": "()",
|
|
272
|
+
"build_shell": "(client, cfg, site, surface)",
|
|
273
|
+
"fill_shell": "(client, cfg, site, surface, master_id, header_id, footer_id, comps)",
|
|
274
|
+
"ensure_components": "(client, cfg, site, surface)",
|
|
275
|
+
"apply_overrides": "(client, instance, key, uses, comps, envelope='templateDocumentInstance')",
|
|
276
|
+
"bind_page": "(client, cfg, master_id, slug, post_id)",
|
|
277
|
+
"build_page_document": "(client, cfg, master_id, template_id, tree, surface)",
|
|
278
|
+
"resolve_components": "(node, comps)",
|
|
279
|
+
"cache_check": "(url, _fresh_bytes=None)",
|
|
280
|
+
"commit": "(client, instance, doc, payload, what)",
|
|
281
|
+
},
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
def test_signatures_unchanged(self):
|
|
285
|
+
import importlib
|
|
286
|
+
for mod, funcs in self.EXPECTED.items():
|
|
287
|
+
m = importlib.import_module(mod)
|
|
288
|
+
for name, sig in funcs.items():
|
|
289
|
+
self.assertTrue(hasattr(m, name), "%s.%s is gone" % (mod, name))
|
|
290
|
+
self.assertEqual(str(inspect.signature(getattr(m, name))), sig, "%s.%s" % (mod, name))
|
|
291
|
+
# every name em925's deploy tool imports (em925_update.py, fill_templates.py,
|
|
292
|
+
# component_categories.py), as em925-總機 listed them on 2026-11-16
|
|
293
|
+
import build_page
|
|
294
|
+
import build_site
|
|
295
|
+
for name in ("Surface", "flatten", "refresh_node_ids", "theme_records",
|
|
296
|
+
"COMPONENT_USES", "unwrap"):
|
|
297
|
+
self.assertTrue(hasattr(build_page, name), "build_page." + name)
|
|
298
|
+
for name in ("commit", "ensure_components", "resolve_components", "apply_overrides",
|
|
299
|
+
"COMPONENT_NAMESPACE", "build_page_document"):
|
|
300
|
+
self.assertTrue(hasattr(build_site, name), "build_site." + name)
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
class SkillDoc(unittest.TestCase):
|
|
304
|
+
HEADINGS = ["## Sources", "## Usage", "## Routing", "## Tasks", "## Verify", "## Maintenance"]
|
|
305
|
+
|
|
306
|
+
def test_size(self):
|
|
307
|
+
self.assertLessEqual(os.path.getsize(os.path.join(ROOT, "SKILL.md")), 20 * 1024)
|
|
308
|
+
|
|
309
|
+
def test_headings_in_order(self):
|
|
310
|
+
text = read("SKILL.md")
|
|
311
|
+
pos = [text.find("\n" + h + "\n") for h in self.HEADINGS]
|
|
312
|
+
self.assertTrue(all(p > 0 for p in pos), pos)
|
|
313
|
+
self.assertEqual(pos, sorted(pos))
|
|
314
|
+
|
|
315
|
+
def test_iron_rule_heads_routing(self):
|
|
316
|
+
text = read("SKILL.md")
|
|
317
|
+
routing = text[text.index("## Routing"):]
|
|
318
|
+
first = routing.split("\n\n")[1]
|
|
319
|
+
self.assertIn("never answer from memory", first)
|
|
320
|
+
self.assertIn("data/pending.csv", first)
|
|
321
|
+
|
|
322
|
+
def test_frontmatter(self):
|
|
323
|
+
fm = read("SKILL.md").split("---", 2)[1]
|
|
324
|
+
self.assertRegex(fm, r"(?m)^user-invocable: true$")
|
|
325
|
+
self.assertRegex(fm, r"(?m)^description: \|$") # install.mjs needs the block form
|
|
326
|
+
self.assertRegex(fm, r"(?m)^ version: ") # under metadata (check-release)
|
|
327
|
+
|
|
328
|
+
def test_numbers_claimed(self):
|
|
329
|
+
import check_numbers
|
|
330
|
+
problems, _ = check_numbers.check()
|
|
331
|
+
self.assertEqual(problems, [])
|
|
332
|
+
|
|
333
|
+
def test_links_resolve(self):
|
|
334
|
+
text = read("SKILL.md")
|
|
335
|
+
for target in re.findall(r"\]\(([^)#]+)\)", text):
|
|
336
|
+
if target.startswith("http"):
|
|
337
|
+
continue
|
|
338
|
+
self.assertTrue(os.path.exists(os.path.join(ROOT, target)), target)
|
|
339
|
+
|
|
340
|
+
def test_referenced_tools_exist(self):
|
|
341
|
+
text = read("SKILL.md")
|
|
342
|
+
for name in set(re.findall(r"\b([a-z_]+\.(?:py|php))\b", text)):
|
|
343
|
+
hits = [os.path.join(d, name) for d in ("tools", "sites", "evals")
|
|
344
|
+
if os.path.exists(os.path.join(ROOT, d, name))]
|
|
345
|
+
self.assertTrue(hits, name)
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
class DataFiles(unittest.TestCase):
|
|
349
|
+
def test_row_counts_match(self):
|
|
350
|
+
text = read("references/data-files.md")
|
|
351
|
+
checked = 0
|
|
352
|
+
for path, n in re.findall(r"^\| `(data/[^`]+)` \| (\d+) +\|", text, re.M):
|
|
353
|
+
full = os.path.join(ROOT, path)
|
|
354
|
+
if os.path.isdir(full):
|
|
355
|
+
got = sum(len(rows(os.path.join(path[5:], f))) for f in os.listdir(full) if f.endswith(".csv"))
|
|
356
|
+
else:
|
|
357
|
+
got = len(rows(path[5:]))
|
|
358
|
+
self.assertEqual(got, int(n), path)
|
|
359
|
+
checked += 1
|
|
360
|
+
self.assertGreater(checked, 40)
|
|
361
|
+
|
|
362
|
+
def test_pending_columns(self):
|
|
363
|
+
r = rows("pending.csv")
|
|
364
|
+
self.assertTrue(r)
|
|
365
|
+
self.assertEqual(set(r[0]), {"date", "question", "why_not_found", "asked_by", "status"})
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
if __name__ == "__main__":
|
|
369
|
+
result = unittest.main(exit=False, verbosity=1).result
|
|
370
|
+
n = result.testsRun
|
|
371
|
+
bad = len(result.failures) + len(result.errors)
|
|
372
|
+
print("\n%d/%d passed" % (n - bad, n))
|
|
373
|
+
sys.exit(1 if bad else 0)
|
package/tools/verify_menus.py
CHANGED