diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-06-30 08:03:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-06-30 08:03:55 +0000 |
commit | 5510bab2f2724b1785efb5e4be0e4fa1e0afbf9e (patch) | |
tree | 8f11dc162604c83298116ce6ac23d64492e2c189 /tests/test_optimizer.py | |
parent | Adding upstream version 16.7.3. (diff) | |
download | sqlglot-5510bab2f2724b1785efb5e4be0e4fa1e0afbf9e.tar.xz sqlglot-5510bab2f2724b1785efb5e4be0e4fa1e0afbf9e.zip |
Adding upstream version 16.7.7.upstream/16.7.7
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/test_optimizer.py')
-rw-r--r-- | tests/test_optimizer.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/test_optimizer.py b/tests/test_optimizer.py index b7425af..40eef9f 100644 --- a/tests/test_optimizer.py +++ b/tests/test_optimizer.py @@ -1,6 +1,7 @@ import unittest from concurrent.futures import ProcessPoolExecutor, as_completed from functools import partial +from unittest.mock import patch import duckdb from pandas.testing import assert_frame_equal @@ -14,6 +15,7 @@ from sqlglot.schema import MappingSchema from tests.helpers import ( TPCDS_SCHEMA, TPCH_SCHEMA, + assert_logger_contains, load_sql_fixture_pairs, load_sql_fixtures, string_to_bool, @@ -411,6 +413,15 @@ FROM READ_CSV('tests/fixtures/optimizer/tpc-h/nation.csv.gz', 'delimiter', '|') {"s.b"}, ) + @patch("sqlglot.optimizer.scope.logger") + def test_scope_warning(self, logger): + self.assertEqual(len(traverse_scope(parse_one("WITH q AS (@y) SELECT * FROM q"))), 1) + assert_logger_contains( + "Cannot traverse scope %s with type '%s'", + logger, + level="warning", + ) + def test_literal_type_annotation(self): tests = { "SELECT 5": exp.DataType.Type.INT, |