mirror of
https://github.com/vegu-ai/talemate.git
synced 2025-09-04 11:29:10 +00:00
17 lines
No EOL
638 B
Python
17 lines
No EOL
638 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 |