Skip to content

Commit ec81a8f

Browse files
Fix tests
1 parent e533850 commit ec81a8f

File tree

2 files changed

+62
-6
lines changed

2 files changed

+62
-6
lines changed

python/tests/__snapshots__/test_bindings/TestEGraph.test_parse_program.py

Lines changed: 60 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,67 @@
11
[
22
Datatype(
3+
Span(
4+
SrcFile(
5+
"test.egg",
6+
'(datatype Math\n (Num i64)\n (Var String)\n (Add Math Math)\n (Mul Math Math))\n\n ;; expr1 = 2 * (x + 3)\n (let expr1 (Mul (Num 2) (Add (Var "x") (Num 3))))',
7+
),
8+
0,
9+
110,
10+
),
311
"Math",
412
[
5-
Variant("Num", ["i64"], None),
6-
Variant("Var", ["String"], None),
7-
Variant("Add", ["Math", "Math"], None),
8-
Variant("Mul", ["Math", "Math"], None),
13+
Variant(
14+
Span(
15+
SrcFile(
16+
"test.egg",
17+
'(datatype Math\n (Num i64)\n (Var String)\n (Add Math Math)\n (Mul Math Math))\n\n ;; expr1 = 2 * (x + 3)\n (let expr1 (Mul (Num 2) (Add (Var "x") (Num 3))))',
18+
),
19+
25,
20+
34,
21+
),
22+
"Num",
23+
["i64"],
24+
None,
25+
),
26+
Variant(
27+
Span(
28+
SrcFile(
29+
"test.egg",
30+
'(datatype Math\n (Num i64)\n (Var String)\n (Add Math Math)\n (Mul Math Math))\n\n ;; expr1 = 2 * (x + 3)\n (let expr1 (Mul (Num 2) (Add (Var "x") (Num 3))))',
31+
),
32+
45,
33+
57,
34+
),
35+
"Var",
36+
["String"],
37+
None,
38+
),
39+
Variant(
40+
Span(
41+
SrcFile(
42+
"test.egg",
43+
'(datatype Math\n (Num i64)\n (Var String)\n (Add Math Math)\n (Mul Math Math))\n\n ;; expr1 = 2 * (x + 3)\n (let expr1 (Mul (Num 2) (Add (Var "x") (Num 3))))',
44+
),
45+
68,
46+
83,
47+
),
48+
"Add",
49+
["Math", "Math"],
50+
None,
51+
),
52+
Variant(
53+
Span(
54+
SrcFile(
55+
"test.egg",
56+
'(datatype Math\n (Num i64)\n (Var String)\n (Add Math Math)\n (Mul Math Math))\n\n ;; expr1 = 2 * (x + 3)\n (let expr1 (Mul (Num 2) (Add (Var "x") (Num 3))))',
57+
),
58+
94,
59+
109,
60+
),
61+
"Mul",
62+
["Math", "Math"],
63+
None,
64+
),
965
],
1066
),
1167
ActionCommand(

python/tests/test_bindings.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def test_parse_and_run_program_exception(self):
8282

8383
with pytest.raises(
8484
EggSmolError,
85-
match="Type mismatch",
85+
match="to have type",
8686
):
8787
egraph.run_program(*parse_program(program))
8888

@@ -202,7 +202,7 @@ def test_sort_alias(self):
202202

203203
class TestVariant:
204204
def test_repr(self):
205-
assert repr(Variant(DUMMY_SPAN, "name", [])) == "Variant('name', [], None)"
205+
assert repr(Variant(DUMMY_SPAN, "name", [])) == f"Variant({DUMMY_SPAN!r}, 'name', [], None)"
206206

207207
def test_name(self):
208208
assert Variant(DUMMY_SPAN, "name", []).name == "name"

0 commit comments

Comments
 (0)