()
| 94 | |
| 95 | |
| 96 | def 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)) |
nothing calls this directly
no test coverage detected