()
| 386 | |
| 387 | |
| 388 | def test_4017(): |
| 389 | path = os.path.normpath(f"{__file__}/../../tests/resources/test_4017.pdf") |
| 390 | with pymupdf.open(path) as document: |
| 391 | page = document[0] |
| 392 | |
| 393 | tables = page.find_tables(add_lines=None) |
| 394 | print(f"{len(tables.tables)=}.") |
| 395 | tables_text = list() |
| 396 | for i, table in enumerate(tables): |
| 397 | print(f"## {i=}.") |
| 398 | t = table.extract() |
| 399 | for tt in t: |
| 400 | print(f" {tt}") |
| 401 | |
| 402 | # 2024-11-29: expect current incorrect output for last two tables. |
| 403 | |
| 404 | expected_a = [ |
| 405 | ["Class A/B Overcollateralization", "131.44%", ">=", "122.60%", "", "PASS"], |
| 406 | [None, None, None, None, None, "PASS"], |
| 407 | ["Class D Overcollateralization", "112.24%", ">=", "106.40%", "", "PASS"], |
| 408 | [None, None, None, None, None, "PASS"], |
| 409 | ["Event of Default", "156.08%", ">=", "102.50%", "", "PASS"], |
| 410 | [None, None, None, None, None, "PASS"], |
| 411 | ["Class A/B Interest Coverage", "N/A", ">=", "120.00%", "", "N/A"], |
| 412 | [None, None, None, None, None, "N/A"], |
| 413 | ["Class D Interest Coverage", "N/A", ">=", "105.00%", "", "N/A"], |
| 414 | ] |
| 415 | assert tables[-2].extract() == expected_a |
| 416 | |
| 417 | expected_b = [ |
| 418 | [ |
| 419 | "Moody's Maximum Rating Factor Test", |
| 420 | "2,577", |
| 421 | "<=", |
| 422 | "3,250", |
| 423 | "", |
| 424 | "PASS", |
| 425 | "2,581", |
| 426 | ], |
| 427 | [None, None, None, None, None, "PASS", None], |
| 428 | [ |
| 429 | "Minimum Floating Spread", |
| 430 | "3.5006%", |
| 431 | ">=", |
| 432 | "2.0000%", |
| 433 | "", |
| 434 | "PASS", |
| 435 | "3.4871%", |
| 436 | ], |
| 437 | [None, None, None, None, None, "PASS", None], |
| 438 | [ |
| 439 | "Minimum Weighted Average S&P Recovery\nRate Test", |
| 440 | "40.50%", |
| 441 | ">=", |
| 442 | "40.00%", |
| 443 | "", |
| 444 | "PASS", |
| 445 | "40.40%", |
nothing calls this directly
no test coverage detected
searching dependent graphs…