Test avoidance of linebreaks.
()
| 4 | |
| 5 | |
| 6 | def test_linebreaks(): |
| 7 | """Test avoidance of linebreaks.""" |
| 8 | path = os.path.abspath(f"{__file__}/../../tests/resources/test-linebreaks.pdf") |
| 9 | doc = pymupdf.open(path) |
| 10 | page = doc[0] |
| 11 | tp = page.get_textpage(flags=pymupdf.TEXTFLAGS_WORDS) |
| 12 | word_count = len(page.get_text("words", textpage=tp)) |
| 13 | line_count1 = len(page.get_text(textpage=tp).splitlines()) |
| 14 | line_count2 = len(page.get_text(sort=True, textpage=tp).splitlines()) |
| 15 | assert word_count == line_count1 |
| 16 | assert line_count2 < line_count1 / 2 |
nothing calls this directly
no test coverage detected
searching dependent graphs…