Skip to content

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

Open
@afallou

Description

@afallou

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions