def test_cut_by_lines_line_ending(self): assert cut_by_lines(text="test\rtest", seg_size=1, overlap=0, last_prop=1) == ["test\r", "test"] assert cut_by_lines(text="test\rtest\ntest", seg_size=1, overlap=0, last_prop=1) == ["test\r", "test\n", "test"] assert cut_by_lines(text="test\r\ntest\ntest", seg_size=2, overlap=1, last_prop=200) == [ "test\r\ntest\ntest"]
def test_cut_by_lines_regular(self): assert cut_by_lines(text="test", seg_size=100, overlap=0, last_prop=0.5) == ["test"] assert cut_by_lines(text="test", seg_size=1, overlap=0, last_prop=1) == ["test"] assert cut_by_lines(text="test\ntest\ntest", seg_size=2, overlap=1, last_prop=1) == ["test\ntest\n", "test\ntest"] assert cut_by_lines(text="test\ntest\ntest", seg_size=1, overlap=0, last_prop=200) == ["test\ntest\ntest"] assert cut_by_lines(text=" \n\ntest", seg_size=1, overlap=0, last_prop=1) == [" \n", "\n", "test"]
def test_cut_by_lines_line_ending(self): assert cut_by_lines(text="test\rtest", seg_size=1, overlap=0, last_prop=1) == ["test\r", "test"] assert cut_by_lines(text="test\rtest\ntest", seg_size=1, overlap=0, last_prop=1) == ["test\r", "test\n", "test"] assert cut_by_lines(text="test\r\ntest\ntest", seg_size=2, overlap=1, last_prop=200) == ["test\r\ntest\ntest"]
def test_cut_by_lines_regular(self): assert cut_by_lines(text="test", seg_size=100, overlap=0, last_prop=0.5) == ["test"] assert cut_by_lines(text="test", seg_size=1, overlap=0, last_prop=1) == ["test"] assert cut_by_lines(text="test\ntest\ntest", seg_size=2, overlap=1, last_prop=1) == ["test\ntest\n", "test\ntest"] assert cut_by_lines(text="test\ntest\ntest", seg_size=1, overlap=0, last_prop=200) == ["test\ntest\ntest"] assert cut_by_lines(text=" \n\ntest", seg_size=1, overlap=0, last_prop=1) == ["test"]
def test_cut_by_lines_larger_seg_size(self): try: _ = cut_by_lines(text="", seg_size=1, overlap=2, last_prop=1) raise AssertionError("smaller seg_size error did not raise") except AssertionError as error: assert str(error) == LARGER_SEG_SIZE_MESSAGE
def test_cut_by_lines_neg_nums(self): try: _ = cut_by_lines(text="", seg_size=1, overlap=-1, last_prop=-1) raise AssertionError("negative number error did not raise") except AssertionError as error: assert str(error) == NEG_OVERLAP_LAST_PROP_MESSAGE
def test_cut_by_lines_zero_seg_size(self): try: _ = cut_by_lines(text="", seg_size=0, overlap=0, last_prop=1) raise AssertionError("zero seg_size error did not raise") except AssertionError as error: assert str(error) == SEG_NON_POSITIVE_MESSAGE
def test_cut_by_lines_empty(self): assert cut_by_lines(text="", seg_size=1, overlap=0, last_prop=1) == [] assert cut_by_lines(text="\n", seg_size=1, overlap=0, last_prop=1) == []
def test_cut_by_lines_empty(self): assert cut_by_lines(text="", seg_size=1, overlap=0, last_prop=1) == [""] assert cut_by_lines(text="\n", seg_size=1, overlap=0, last_prop=1) == ["\n"]