Files
talemate/tests/test_strip_partial_sentences.py
veguAI fb2fa31f13 linting
* precommit

* linting

* add linting to workflow

* ruff.toml added
2025-06-29 19:51:08 +03:00

23 lines
692 B
Python

import pytest
from talemate.util import strip_partial_sentences
@pytest.mark.parametrize(
"input, expected",
[
(
"This is a test{delim} This is a test{delim}",
"This is a test{delim} This is a test{delim}",
),
("This is a test{delim} This is a test", "This is a test{delim}"),
("This is a test{delim}\nThis is a test", "This is a test{delim}"),
],
)
def test_strip_partial_sentences(input, expected):
delimiters = [".", "!", "?", '"', "*"]
for delim in delimiters:
input = input.format(delim=delim)
expected = expected.format(delim=delim)
assert strip_partial_sentences(input) == expected