diff options
Diffstat (limited to 'tests/test_schema.py')
-rw-r--r-- | tests/test_schema.py | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/tests/test_schema.py b/tests/test_schema.py index 8bdd312..32686d7 100644 --- a/tests/test_schema.py +++ b/tests/test_schema.py @@ -166,32 +166,30 @@ class TestSchema(unittest.TestCase): schema = MappingSchema({"A": {"b": "varchar"}}) self.assertEqual(schema.get_column_type("a", "B").this, exp.DataType.Type.VARCHAR) self.assertEqual( - schema.get_column_type(exp.Table(this="a"), exp.Column(this="b")).this, + schema.get_column_type(exp.table_("a"), exp.column("b")).this, exp.DataType.Type.VARCHAR, ) self.assertEqual( - schema.get_column_type("a", exp.Column(this="b")).this, exp.DataType.Type.VARCHAR + schema.get_column_type("a", exp.column("b")).this, exp.DataType.Type.VARCHAR ) self.assertEqual( - schema.get_column_type(exp.Table(this="a"), "b").this, exp.DataType.Type.VARCHAR + schema.get_column_type(exp.table_("a"), "b").this, exp.DataType.Type.VARCHAR ) schema = MappingSchema({"a": {"b": {"c": "varchar"}}}) self.assertEqual( - schema.get_column_type(exp.Table(this="b", db="a"), exp.Column(this="c")).this, + schema.get_column_type(exp.table_("b", db="a"), exp.column("c")).this, exp.DataType.Type.VARCHAR, ) self.assertEqual( - schema.get_column_type(exp.Table(this="b", db="a"), "c").this, exp.DataType.Type.VARCHAR + schema.get_column_type(exp.table_("b", db="a"), "c").this, exp.DataType.Type.VARCHAR ) schema = MappingSchema({"a": {"b": {"c": {"d": "varchar"}}}}) self.assertEqual( - schema.get_column_type( - exp.Table(this="c", db="b", catalog="a"), exp.Column(this="d") - ).this, + schema.get_column_type(exp.table_("c", db="b", catalog="a"), exp.column("d")).this, exp.DataType.Type.VARCHAR, ) self.assertEqual( - schema.get_column_type(exp.Table(this="c", db="b", catalog="a"), "d").this, + schema.get_column_type(exp.table_("c", db="b", catalog="a"), "d").this, exp.DataType.Type.VARCHAR, ) @@ -204,14 +202,14 @@ class TestSchema(unittest.TestCase): dialect="clickhouse", ) - table_z = exp.Table(this="z", db="y", catalog="x") - table_w = exp.Table(this="w", db="y", catalog="x") + table_z = exp.table_("z", db="y", catalog="x") + table_w = exp.table_("w", db="y", catalog="x") self.assertEqual(schema.column_names(table_z), ["a", "B"]) self.assertEqual(schema.column_names(table_w), ["c"]) schema = MappingSchema(schema={"x": {"`y`": "INT"}}, dialect="clickhouse") - self.assertEqual(schema.column_names(exp.Table(this="x")), ["y"]) + self.assertEqual(schema.column_names(exp.table_("x")), ["y"]) # Check that add_table normalizes both the table and the column names to be added / updated schema = MappingSchema() |