예제 #1
0
 def lines(self, text):
     return list(select_lines(text))
예제 #2
0
 def test_returns_empty_list_when_no_matches_with_callback(self, text) -> None:
     callbacks = [lambda box:  "z" in box.get_text()]
     result = list(select_lines(text, *callbacks))
     assert len(result) == 0
예제 #3
0
 def test_filters_results_with_multiple_callbacks(self, text) -> None:
     callbacks = [lambda box:  "b" in box.get_text(), lambda box: box.y0 > 500,  lambda box: box.y1 < 600]
     result = list(select_lines(text, *callbacks))
     assert len(result) == 4
예제 #4
0
 def test_filters_results_with_callback_function(self, text) -> None:
     result = list(select_lines(text, lambda ln:  "a" in ln.get_text()))
     assert len(result) == 46
예제 #5
0
 def test_returns_lines_from_multiple_pages(self, pages) -> None:
     result = select_lines(pages)
     for line in result:
         assert isinstance(line, LTTextLine)
예제 #6
0
 def test_returns_lines_from_single_textbox(self, textboxes) -> None:
     result = select_lines(textboxes[0])
     for line in result:
         assert isinstance(line, LTTextLine)
예제 #7
0
 def test_returns_iterable(self, text) -> None:
     result = select_lines(text)
     assert isinstance(result, Iterable)