Merge remote-tracking branch 'origin/main' into issue-4-variable-pool
This commit is contained in:
commit
58a2d8a1f1
3 files changed
+158
-37
No files matched your search
@@ -0,0 +1,23 @@
|
||||
import collections
|
||||
|
||||
from isotope_typst.evaluate import balanced, read_jsonl
|
||||
from isotope_typst.validate import compiles_many
|
||||
|
||||
|
||||
def test_balanced():
|
||||
assert balanced("frac(sin(x), x)")
|
||||
assert balanced("sum_(i = 1)^n i")
|
||||
assert not balanced("(x + 1)^2 + 1)^2 + 1)^2")
|
||||
assert not balanced("(-frac(b, 2)")
|
||||
assert not balanced("x y z frac(x")
|
||||
assert not balanced("(x]")
|
||||
|
||||
|
||||
def test_hand_test_is_well_formed():
|
||||
rows = read_jsonl("eval/hand_test.jsonl")
|
||||
assert len(rows) >= 100
|
||||
assert all(set(r) == {"en", "typ", "cat"} for r in rows)
|
||||
assert all(balanced(r["typ"]) for r in rows)
|
||||
assert all(compiles_many([r["typ"] for r in rows]))
|
||||
dupes = [en for en, k in collections.Counter(r["en"] for r in rows).items() if k > 1]
|
||||
assert not dupes, dupes
|
||||
Reference in new issue
Block a user