Skip to content

Commit fe6fdbe

Browse files
committed
Test that optimizer.simplify successfully mutates non-root nodes
1 parent 85e62b8 commit fe6fdbe

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tests/test_optimizer.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,11 @@ def test_pushdown_projection(self):
533533
def test_simplify(self):
534534
self.check_file("simplify", simplify)
535535

536+
# Ensure simplify mutates the AST properly
537+
expression = parse_one("SELECT 1 + 2")
538+
simplify(expression.selects[0])
539+
self.assertEqual(expression.sql(), "SELECT 3")
540+
536541
expression = parse_one("SELECT a, c, b FROM table1 WHERE 1 = 1")
537542
self.assertEqual(simplify(simplify(expression.find(exp.Where))).sql(), "WHERE TRUE")
538543

0 commit comments

Comments
 (0)