21 lines
532 B
Python
21 lines
532 B
Python
import sys
|
|
import os
|
|
|
|
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
|
|
|
|
from main import chunk_text
|
|
|
|
|
|
def test_chunk_text_empty_returns_empty_list():
|
|
assert chunk_text("") == []
|
|
|
|
|
|
def test_chunk_text_shorter_than_chunk_size_returns_single_chunk():
|
|
assert chunk_text("hello", chunk_size=1000, overlap=100) == ["hello"]
|
|
|
|
|
|
def test_chunk_text_exact_multiple_of_chunk_size():
|
|
text = "a" * 20
|
|
chunks = chunk_text(text, chunk_size=10, overlap=2)
|
|
assert chunks == [text[0:10], text[8:18], text[16:20]]
|