25 lines
641 B
Python
25 lines
641 B
Python
from genesis.parsers.paragraph_splitter import split_paragraphs
|
|
|
|
|
|
def test_empty_matrix():
|
|
assert split_paragraphs([]) == []
|
|
|
|
|
|
def test_single_paragraph_no_empty_rows():
|
|
m = [["a", "b"], ["c", "d"]]
|
|
assert split_paragraphs(m) == [(0, 1)]
|
|
|
|
|
|
def test_split_on_middle_empty_row():
|
|
m = [["a"], [], ["b"], ["c"], []]
|
|
assert split_paragraphs(m) == [(0, 0), (2, 3)]
|
|
|
|
|
|
def test_trailing_empty_rows_no_extra_paragraph():
|
|
m = [["a"], [], [], []]
|
|
assert split_paragraphs(m) == [(0, 0)]
|
|
|
|
|
|
def test_leading_empty_rows_start_at_first_nonempty():
|
|
m = [[], ["a"], [], ["b"]]
|
|
assert split_paragraphs(m) == [(1, 1), (3, 3)] |