Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python: "take item" selects part of comment before item #2803

Open
afallou opened this issue Jan 31, 2025 · 1 comment
Open

Python: "take item" selects part of comment before item #2803

afallou opened this issue Jan 31, 2025 · 1 comment
Labels
enhancement New feature or request

Comments

@afallou
Copy link

afallou commented Jan 31, 2025

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:

Image

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:
Image

@afallou afallou changed the title Python: "take item" includes part of comment Python: "take item" selects part of comment before item Jan 31, 2025
@AndreasArvidsson
Copy link
Member

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.

@AndreasArvidsson AndreasArvidsson added the enhancement New feature or request label Jan 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants