Adding upstream version 11.4.1.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
d160fb48f7
commit
36706608dc
89 changed files with 35352 additions and 33081 deletions
|
@ -6,6 +6,8 @@ from sqlglot import alias, exp, parse_one
|
|||
|
||||
|
||||
class TestExpressions(unittest.TestCase):
|
||||
maxDiff = None
|
||||
|
||||
def test_arg_key(self):
|
||||
self.assertEqual(parse_one("sum(1)").find(exp.Literal).arg_key, "this")
|
||||
|
||||
|
@ -91,6 +93,32 @@ class TestExpressions(unittest.TestCase):
|
|||
self.assertIsInstance(column.parent_select, exp.Select)
|
||||
self.assertIsNone(column.find_ancestor(exp.Join))
|
||||
|
||||
def test_to_dot(self):
|
||||
column = parse_one('a.b.c."d".e.f').find(exp.Column)
|
||||
dot = column.to_dot()
|
||||
|
||||
self.assertEqual(dot.sql(), 'a.b.c."d".e.f')
|
||||
|
||||
self.assertEqual(
|
||||
dot,
|
||||
exp.Dot(
|
||||
this=exp.Dot(
|
||||
this=exp.Dot(
|
||||
this=exp.Dot(
|
||||
this=exp.Dot(
|
||||
this=exp.to_identifier("a"),
|
||||
expression=exp.to_identifier("b"),
|
||||
),
|
||||
expression=exp.to_identifier("c"),
|
||||
),
|
||||
expression=exp.to_identifier("d", quoted=True),
|
||||
),
|
||||
expression=exp.to_identifier("e"),
|
||||
),
|
||||
expression=exp.to_identifier("f"),
|
||||
),
|
||||
)
|
||||
|
||||
def test_root(self):
|
||||
ast = parse_one("select * from (select a from x)")
|
||||
self.assertIs(ast, ast.root())
|
||||
|
@ -480,6 +508,7 @@ class TestExpressions(unittest.TestCase):
|
|||
self.assertIsInstance(parse_one("COMMIT"), exp.Commit)
|
||||
self.assertIsInstance(parse_one("ROLLBACK"), exp.Rollback)
|
||||
self.assertIsInstance(parse_one("GENERATE_SERIES(a, b, c)"), exp.GenerateSeries)
|
||||
self.assertIsInstance(parse_one("COUNT_IF(a > 0)"), exp.CountIf)
|
||||
|
||||
def test_column(self):
|
||||
column = parse_one("a.b.c.d")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue