summaryrefslogtreecommitdiffstats
path: root/tests/test_schema.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 05:35:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 05:35:55 +0000
commitfe979e8421c04c038353a0a2d07d81779516186a (patch)
treeefb70a52261e5cf4862a7eb69e1d7cd16356fcba /tests/test_schema.py
parentReleasing debian version 23.13.7-1. (diff)
downloadsqlglot-fe979e8421c04c038353a0a2d07d81779516186a.tar.xz
sqlglot-fe979e8421c04c038353a0a2d07d81779516186a.zip
Merging upstream version 23.16.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/test_schema.py')
-rw-r--r--tests/test_schema.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/test_schema.py b/tests/test_schema.py
index 32686d7..5b50867 100644
--- a/tests/test_schema.py
+++ b/tests/test_schema.py
@@ -271,6 +271,34 @@ class TestSchema(unittest.TestCase):
"Table z must match the schema's nesting level: 2.",
)
+ with self.assertRaises(SchemaError) as ctx:
+ MappingSchema(
+ {
+ "catalog": {
+ "db": {"tbl": {"col": "a"}},
+ },
+ "tbl2": {"col": "b"},
+ },
+ )
+ self.assertEqual(
+ str(ctx.exception),
+ "Table tbl2 must match the schema's nesting level: 3.",
+ )
+
+ with self.assertRaises(SchemaError) as ctx:
+ MappingSchema(
+ {
+ "tbl2": {"col": "b"},
+ "catalog": {
+ "db": {"tbl": {"col": "a"}},
+ },
+ },
+ )
+ self.assertEqual(
+ str(ctx.exception),
+ "Table catalog.db.tbl must match the schema's nesting level: 1.",
+ )
+
def test_has_column(self):
schema = MappingSchema({"x": {"c": "int"}})
self.assertTrue(schema.has_column("x", exp.column("c")))