1
0
Fork 0

Adding upstream version 17.9.1.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-13 20:47:46 +01:00
parent 4a22906fbb
commit 19b35e2a28
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
87 changed files with 45907 additions and 42511 deletions

View file

@ -238,3 +238,37 @@ class TestSchema(unittest.TestCase):
schema = MappingSchema(schema={"Foo": {"`BaR`": "int"}}, dialect="bigquery")
self.assertEqual(schema.column_names("Foo"), ["bar"])
self.assertEqual(schema.column_names("foo"), [])
# Check that the schema's normalization setting can be overridden
schema = MappingSchema(schema={"X": {"y": "int"}}, normalize=False, dialect="snowflake")
self.assertEqual(schema.column_names("x", normalize=True), ["y"])
def test_same_number_of_qualifiers(self):
schema = MappingSchema({"x": {"y": {"c1": "int"}}})
with self.assertRaises(SchemaError) as ctx:
schema.add_table("z", {"c2": "int"})
self.assertEqual(
str(ctx.exception),
"Table z must match the schema's nesting level: 2.",
)
schema = MappingSchema()
schema.add_table("x.y", {"c1": "int"})
with self.assertRaises(SchemaError) as ctx:
schema.add_table("z", {"c2": "int"})
self.assertEqual(
str(ctx.exception),
"Table z must match the schema's nesting level: 2.",
)
with self.assertRaises(SchemaError) as ctx:
MappingSchema({"x": {"y": {"c1": "int"}}, "z": {"c2": "int"}})
self.assertEqual(
str(ctx.exception),
"Table z must match the schema's nesting level: 2.",
)