Python: "take item" selects part of comment before item
I have this pytest file:
import pytest
from freezegun import freeze_time
from quaero_api.models.published_item_query import QueryField
@pytest.mark.parametrize(
"field, keywords, expected_output",
[
# The extra space before the ~ should still work, making sure it doesn't create another issue
(
QueryField.TITLE_OR_ABSTRACT,
['"the two" ~5'],
'Title:("the two" ~5) OR ArticleTitle:("the two" ~5) OR AbstractText.Abstract:("the two" ~5)',
),
],
)
@freeze_time("2022-09-17")
def test_build_query_segment_string(field: QueryField, keywords: list[str], expected_output: str) -> None:
assert field.build_query_segment_string(keywords) == expected_output
I have a yellow hat on the "Q" of "QueryField" in those lines:
I wanted to add another parametrized case by cloning that tuple-valued list item. clone item round yellow quench was giving me weird results, which got me to notice that take item round yellow quench was resulting in the selection of a piece of the comment above the tuple.
More precisely, this whole thing ends up selected:
The items scope has no understanding of comments today. The only thing it does is split on commas. This is of course something we want to improve in the future, but today it's not a bug in the current implementation; it's not just a feature we have implemented yet.