nikhil_staging / src /signals /splitters /text_splitter_test_utils_test.py
nsthorat's picture
Push
e4f9cbe
raw
history blame
No virus
479 Bytes
"""Test the text splitter utils."""
from ...data.dataset_utils import lilac_span
from .text_splitter_test_utils import text_to_expected_spans
def test_text_to_expected_spans() -> None:
"""Tests the sentences_to_expected_spans function."""
text = 'Hello. Hello. Final sentence.'
sentences = ['Hello.', 'Hello.', 'Final sentence.']
assert text_to_expected_spans(
text, sentences) == [lilac_span(0, 6), lilac_span(7, 13),
lilac_span(14, 29)]