Test invalidating parent on page re-assignment.
()
| 457 | |
| 458 | |
| 459 | def test_parent(): |
| 460 | """Test invalidating parent on page re-assignment.""" |
| 461 | doc = pymupdf.open() |
| 462 | page = doc.new_page() |
| 463 | a = page.add_highlight_annot(page.rect) # insert annotation on page 0 |
| 464 | page = doc.new_page() # make a new page, should orphanate annotation |
| 465 | try: |
| 466 | print(a) # should raise |
| 467 | except Exception as e: |
| 468 | if platform.system() == 'OpenBSD': |
| 469 | assert isinstance(e, pymupdf.mupdf.FzErrorBase), f'Incorrect {type(e)=}.' |
| 470 | else: |
| 471 | assert isinstance(e, pymupdf.mupdf.FzErrorArgument), f'Incorrect {type(e)=}.' |
| 472 | assert str(e) == 'code=4: annotation not bound to any page', f'Incorrect error text {str(e)=}.' |
| 473 | else: |
| 474 | assert 0, f'Failed to get expected exception.' |
| 475 | |
| 476 | def test_4047(): |
| 477 | path = os.path.normpath(f'{__file__}/../../tests/resources/test_4047.pdf') |
nothing calls this directly
no test coverage detected
searching dependent graphs…