()
| 85 | |
| 86 | |
| 87 | def 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 | |
| 105 | def test_multiple_cte_extraction(): |
nothing calls this directly
no test coverage detected