Skip to content

Commit cca60f6

Browse files
committed
only run ->> tests on version >=3.38
1 parent 2fcaccb commit cca60f6

File tree

1 file changed

+27
-26
lines changed

1 file changed

+27
-26
lines changed

tests/test-loadable.py

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -300,32 +300,33 @@ def test_regex_captures(self):
300300
]
301301
)
302302
# with ->> syntax
303-
self.assertEqual(
304-
execute_all(
305-
"""
306-
select
307-
comments.rowid as comment,
308-
captures.rowid as capture_idx,
309-
captures ->> 'title' as title2,
310-
captures ->> 'year' as year2
311-
from comments
312-
join regex_captures(
313-
regex(?),
314-
comments.comment
315-
)as captures;
316-
""", [MOVIE_PATTERN]
317-
),
318-
[
319-
{'comment': 0, 'capture_idx': 0, 'title2': 'Citizen Kane', 'year2': '1941'},
320-
{'comment': 0, 'capture_idx': 1, 'title2': 'The Wizard of Oz', 'year2': '1939'},
321-
{'comment': 0, 'capture_idx': 2, 'title2': 'M', 'year2': '1931'},
322-
{'comment': 1, 'capture_idx': 0, 'title2': 'Moonlight', 'year2': '2016'},
323-
{'comment': 1, 'capture_idx': 1, 'title2': 'Arrival', 'year2': '2016'},
324-
{'comment': 2, 'capture_idx': 0, 'title2': 'Parasite', 'year2': '2020'},
325-
{'comment': 2, 'capture_idx': 1, 'title2': 'Joker', 'year2': '2019'},
326-
{'comment': 2, 'capture_idx': 2, 'title2': 'Marriage Story', 'year2': '2019'}
327-
]
328-
)
303+
if sqlite3.sqlite_version_info[1] >= 38:
304+
self.assertEqual(
305+
execute_all(
306+
"""
307+
select
308+
comments.rowid as comment,
309+
captures.rowid as capture_idx,
310+
captures ->> 'title' as title2,
311+
captures ->> 'year' as year2
312+
from comments
313+
join regex_captures(
314+
regex(?),
315+
comments.comment
316+
)as captures;
317+
""", [MOVIE_PATTERN]
318+
),
319+
[
320+
{'comment': 0, 'capture_idx': 0, 'title2': 'Citizen Kane', 'year2': '1941'},
321+
{'comment': 0, 'capture_idx': 1, 'title2': 'The Wizard of Oz', 'year2': '1939'},
322+
{'comment': 0, 'capture_idx': 2, 'title2': 'M', 'year2': '1931'},
323+
{'comment': 1, 'capture_idx': 0, 'title2': 'Moonlight', 'year2': '2016'},
324+
{'comment': 1, 'capture_idx': 1, 'title2': 'Arrival', 'year2': '2016'},
325+
{'comment': 2, 'capture_idx': 0, 'title2': 'Parasite', 'year2': '2020'},
326+
{'comment': 2, 'capture_idx': 1, 'title2': 'Joker', 'year2': '2019'},
327+
{'comment': 2, 'capture_idx': 2, 'title2': 'Marriage Story', 'year2': '2019'}
328+
]
329+
)
329330

330331
def test_regex_find_all(self):
331332
regex_find_all = lambda pattern, content: execute_all("select rowid, * from regex_find_all(?, ?)", [pattern, content])

0 commit comments

Comments
 (0)