diff options
Diffstat (limited to 'tests/test_optimizer.py')
-rw-r--r-- | tests/test_optimizer.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/tests/test_optimizer.py b/tests/test_optimizer.py index 141203d..9b68c78 100644 --- a/tests/test_optimizer.py +++ b/tests/test_optimizer.py @@ -109,7 +109,9 @@ class TestOptimizer(unittest.TestCase): }, } - def check_file(self, file, func, pretty=False, execute=False, set_dialect=False, **kwargs): + def check_file( + self, file, func, pretty=False, execute=False, set_dialect=False, only=None, **kwargs + ): with ProcessPoolExecutor() as pool: results = {} @@ -117,6 +119,8 @@ class TestOptimizer(unittest.TestCase): load_sql_fixture_pairs(f"optimizer/{file}.sql"), start=1 ): title = meta.get("title") or f"{i}, {sql}" + if only and title != only: + continue dialect = meta.get("dialect") leave_tables_isolated = meta.get("leave_tables_isolated") @@ -137,13 +141,14 @@ class TestOptimizer(unittest.TestCase): ) for future in as_completed(results): - optimized = future.result() sql, title, expected, dialect, execute = results[future] with self.subTest(title): + optimized = future.result() + actual = optimized.sql(pretty=pretty, dialect=dialect) self.assertEqual( expected, - optimized.sql(pretty=pretty, dialect=dialect), + actual, ) if string_to_bool(execute): @@ -309,7 +314,7 @@ class TestOptimizer(unittest.TestCase): self.check_file("pushdown_projections", pushdown_projections, schema=self.schema) def test_simplify(self): - self.check_file("simplify", simplify) + self.check_file("simplify", simplify, set_dialect=True) expression = parse_one("TRUE AND TRUE AND TRUE") self.assertEqual(exp.true(), optimizer.simplify.simplify(expression)) |