← baseline_full_v2

rich_3454

failed NO_PATCH NO_PATCH UNSUBMITTED empty_patch(None) · None tool calls · 0 s · Textualize/rich

Task input

Fix [BUG] @ breaks highlighting in hyperlink #3327

## Type of changes

- [x] Bug fix
- [ ] New feature
- [ ] Documentation / docstrings
- [x] Tests
- [ ] Other

## Checklist

- [ ] I've run the latest [black](https://github.com/psf/black) with default args on new code.
- [ ] I've updated CHANGELOG.md and CONTRIBUTORS.md where appropriate.
- [x] I've added tests for new code.
- [x] I accept that @willmcgugan may be pedantic in the code review.

## Description
Fixed the bug [#3327](https://github.com/Textualize/rich/issues/3327).

Changes -
1. Added '@' in rich.highlighter:ReprHighlighter url regex pattern.
2. Added a test case in test_highlighter for the url with '@'.

## Note
Poetry installed black v22.12.0 and its formatting differs a bit from the latest version v24.8.0. Hence I've formatted with the prior to keep it consistent.

Tool calls (0)

#ToolArgumentsResult
No trace captured.

Test output

show
.......................................F
=================================== FAILURES ===================================
_____ test_highlight_regex[https://www.youtube.com/@LinusTechTips-spans38] _____

test = 'https://www.youtube.com/@LinusTechTips'
spans = [Span(0, 38, 'repr.url')]

    @pytest.mark.parametrize("test, spans", highlight_tests)
    def test_highlight_regex(test: str, spans: List[Span]):
        """Tests for the regular expressions used in ReprHighlighter."""
        text = Text(test)
        highlighter = ReprHighlighter()
        highlighter.highlight(text)
        print(text.spans)
>       assert text.spans == spans
E       AssertionError: assert [Span(0, 24, 'repr.url')] == [Span(0, 38, 'repr.url')]
E         
E         At index 0 diff: Span(0, 24, 'repr.url') != Span(0, 38, 'repr.url')
E         Use -v to get more diff

tests/test_highlighter.py:167: AssertionError
----------------------------- Captured stdout call -----------------------------
[Span(0, 24, 'repr.url')]
!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
1 failed, 39 passed in 0.07s