MCPcopy Index your code
hub / github.com/dbcli/pgcli / test_cte_extraction_around_comments

Function test_cte_extraction_around_comments

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

Source from the content-addressed store, hash-verified

85
86
87def test_cte_extraction_around_comments():
88 sql = """--blah blah blah
89 WITH a AS (SELECT abc def FROM x)
90 SELECT * FROM a"""
91 start_pos = len(
92 """--blah blah blah
93 WITH a AS """
94 )
95 stop_pos = len(
96 """--blah blah blah
97 WITH a AS (SELECT abc def FROM x)"""
98 )
99
100 ctes, remainder = extract_ctes(sql)
101 assert tuple(ctes) == (("a", ("def",), start_pos, stop_pos),)
102 assert remainder.strip() == "SELECT * FROM a"
103
104
105def test_multiple_cte_extraction():

Callers

nothing calls this directly

Calls 1

extract_ctesFunction · 0.90

Tested by

no test coverage detected