diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-09-25 07:53:34 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-09-25 07:53:34 +0000 |
commit | b17286099803e7c69860f8827ed22de59d9e9c8e (patch) | |
tree | 4a8cf23f7f7a2368f9223eb29ccc1de1a4c84f79 /tests | |
parent | Releasing debian version 6.2.0-1. (diff) | |
download | sqlglot-b17286099803e7c69860f8827ed22de59d9e9c8e.tar.xz sqlglot-b17286099803e7c69860f8827ed22de59d9e9c8e.zip |
Merging upstream version 6.2.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | tests/test_expressions.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/test_expressions.py b/tests/test_expressions.py index 59d584c..64ad02d 100644 --- a/tests/test_expressions.py +++ b/tests/test_expressions.py @@ -414,3 +414,34 @@ class TestExpressions(unittest.TestCase): self.assertEqual(parse_one("heLLO()").sql(normalize_functions=None), "heLLO()") self.assertEqual(parse_one("SUM(x)").sql(normalize_functions="lower"), "sum(x)") self.assertEqual(parse_one("sum(x)").sql(normalize_functions="upper"), "SUM(x)") + + def test_properties_from_dict(self): + self.assertEqual( + exp.Properties.from_dict( + { + "FORMAT": "parquet", + "PARTITIONED_BY": [exp.to_identifier("a"), exp.to_identifier("b")], + "custom": 1, + "TABLE_FORMAT": exp.to_identifier("test_format"), + "ENGINE": None, + "COLLATE": True, + } + ), + exp.Properties( + expressions=[ + exp.FileFormatProperty(this=exp.Literal.string("FORMAT"), value=exp.Literal.string("parquet")), + exp.PartitionedByProperty( + this=exp.Literal.string("PARTITIONED_BY"), + value=exp.Tuple(expressions=[exp.to_identifier("a"), exp.to_identifier("b")]), + ), + exp.AnonymousProperty(this=exp.Literal.string("custom"), value=exp.Literal.number(1)), + exp.TableFormatProperty( + this=exp.Literal.string("TABLE_FORMAT"), value=exp.to_identifier("test_format") + ), + exp.EngineProperty(this=exp.Literal.string("ENGINE"), value=exp.NULL), + exp.CollateProperty(this=exp.Literal.string("COLLATE"), value=exp.TRUE), + ] + ), + ) + + self.assertRaises(ValueError, exp.Properties.from_dict, {"FORMAT": {"key": "value"}}) |