From 8f1b330983bddb35e2ec61a5667a84318bad88ef Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 18 May 2024 07:35:50 +0200 Subject: Adding upstream version 23.16.0. Signed-off-by: Daniel Baumann --- tests/test_schema.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'tests/test_schema.py') 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"))) -- cgit v1.2.3