Skip to content

Commit

Permalink
tests PymbolicToASTMapper
Browse files Browse the repository at this point in the history
  • Loading branch information
kaushikcfd committed Jul 28, 2022
1 parent ee33327 commit 9380b52
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/test_pymbolic.py
Original file line number Diff line number Diff line change
Expand Up @@ -955,6 +955,18 @@ def test_nodecount():
assert get_num_nodes(expr) == 12


def test_python_ast_interop_roundtrip():
from pymbolic.interop.ast import (ASTToPymbolic,
PymbolicToASTMapper)

ast2p = ASTToPymbolic()
p2ast = PymbolicToASTMapper()
ntests = 40
for i in range(ntests):
expr = generate_random_expression(seed=(5+i))
assert ast2p(p2ast(expr)) == expr


if __name__ == "__main__":
import sys
if len(sys.argv) > 1:
Expand Down

0 comments on commit 9380b52

Please sign in to comment.