Skip to content

Commit 646c9de

Browse files
kaushikcfdinducer
authored andcommitted
tests PymbolicToASTMapper
1 parent ae4bf11 commit 646c9de

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test/test_pymbolic.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -955,6 +955,18 @@ def test_nodecount():
955955
assert get_num_nodes(expr) == 12
956956

957957

958+
def test_python_ast_interop_roundtrip():
959+
from pymbolic.interop.ast import (ASTToPymbolic,
960+
PymbolicToASTMapper)
961+
962+
ast2p = ASTToPymbolic()
963+
p2ast = PymbolicToASTMapper()
964+
ntests = 40
965+
for i in range(ntests):
966+
expr = generate_random_expression(seed=(5+i))
967+
assert ast2p(p2ast(expr)) == expr
968+
969+
958970
if __name__ == "__main__":
959971
import sys
960972
if len(sys.argv) > 1:

0 commit comments

Comments
 (0)