v2.16.0 (#798)
Co-authored-by: Hdandria <henri.dandria@mistral.ai> Co-authored-by: Liam Lyons <65613603+lyons-liam@users.noreply.github.com> Co-authored-by: Mathias Gesbert <mathias.gesbert@mistral.ai> Co-authored-by: Pierre Rossinès <pierre.rossines@mistral.ai> Co-authored-by: Quentin <quentin.torroba@mistral.ai> Co-authored-by: allansimon-mistral <allan.simon@ext.mistral.ai> Co-authored-by: angelapopopo <angele.lenglemetz@mistral.ai> Co-authored-by: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
parent
cafb6d4147
commit
c2cb612ac1
67 changed files with 2704 additions and 197 deletions
29
tests/core/test_text.py
Normal file
29
tests/core/test_text.py
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from vibe.core.utils.text import snippet_start_line
|
||||
|
||||
|
||||
class TestSnippetStartLine:
|
||||
def test_finds_line_number(self) -> None:
|
||||
assert snippet_start_line("a\nb\nc\nd\n", "c") == 3
|
||||
|
||||
def test_first_line(self) -> None:
|
||||
assert snippet_start_line("hello\nworld", "hello") == 1
|
||||
|
||||
def test_multiline_snippet(self) -> None:
|
||||
assert snippet_start_line("a\nb\nc", "\nb\n") == 2
|
||||
|
||||
def test_first_occurrence_when_repeated(self) -> None:
|
||||
assert snippet_start_line("x\nx\nx", "x") == 1
|
||||
|
||||
def test_leading_newline_anchors_first_content_line(self) -> None:
|
||||
assert snippet_start_line("bar\nx\nbar", "\nbar") == 3
|
||||
|
||||
def test_returns_none_when_exact_snippet_absent(self) -> None:
|
||||
assert snippet_start_line("a\nb\nfoo", "foo\n") is None
|
||||
|
||||
def test_not_found(self) -> None:
|
||||
assert snippet_start_line("hello\nworld", "missing") is None
|
||||
|
||||
def test_blank_snippet(self) -> None:
|
||||
assert snippet_start_line("hello", "\n") is None
|
||||
Loading…
Add table
Add a link
Reference in a new issue