()
| 103 | |
| 104 | |
| 105 | def test_multiple_cte_extraction(): |
| 106 | sql = """WITH |
| 107 | x AS (SELECT abc, def FROM x), |
| 108 | y AS (SELECT ghi, jkl FROM y) |
| 109 | SELECT * FROM a, b""" |
| 110 | |
| 111 | start1 = len( |
| 112 | """WITH |
| 113 | x AS """ |
| 114 | ) |
| 115 | |
| 116 | stop1 = len( |
| 117 | """WITH |
| 118 | x AS (SELECT abc, def FROM x)""" |
| 119 | ) |
| 120 | |
| 121 | start2 = len( |
| 122 | """WITH |
| 123 | x AS (SELECT abc, def FROM x), |
| 124 | y AS """ |
| 125 | ) |
| 126 | |
| 127 | stop2 = len( |
| 128 | """WITH |
| 129 | x AS (SELECT abc, def FROM x), |
| 130 | y AS (SELECT ghi, jkl FROM y)""" |
| 131 | ) |
| 132 | |
| 133 | ctes, remainder = extract_ctes(sql) |
| 134 | assert tuple(ctes) == ( |
| 135 | ("x", ("abc", "def"), start1, stop1), |
| 136 | ("y", ("ghi", "jkl"), start2, stop2), |
| 137 | ) |
nothing calls this directly
no test coverage detected