MCPcopy Create free account
hub / github.com/dbcli/mssql-cli / test_multiple_cte_extraction

Function test_multiple_cte_extraction

tests/parseutils/test_ctes.py:96–119  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

94
95
96def test_multiple_cte_extraction():
97 sql = '''WITH
98 x AS (SELECT abc, def FROM x),
99 y AS (SELECT ghi, jkl FROM y)
100 SELECT * FROM a, b'''
101
102 start1 = len('''WITH
103 x AS ''')
104
105 stop1 = len('''WITH
106 x AS (SELECT abc, def FROM x)''')
107
108 start2 = len('''WITH
109 x AS (SELECT abc, def FROM x),
110 y AS ''')
111
112 stop2 = len('''WITH
113 x AS (SELECT abc, def FROM x),
114 y AS (SELECT ghi, jkl FROM y)''')
115
116 ctes, remainder = extract_ctes(sql)
117 assert tuple(ctes) == (
118 ('x', ('abc', 'def'), start1, stop1),
119 ('y', ('ghi', 'jkl'), start2, stop2))

Callers

nothing calls this directly

Calls 1

extract_ctesFunction · 0.90

Tested by

no test coverage detected