(rep: BaseReport)
| 571 | return None |
| 572 | |
| 573 | def serialize_exception_longrepr(rep: BaseReport) -> dict[str, Any]: |
| 574 | assert rep.longrepr is not None |
| 575 | # TODO: Investigate whether the duck typing is really necessary here. |
| 576 | longrepr = cast(ExceptionRepr, rep.longrepr) |
| 577 | result: dict[str, Any] = { |
| 578 | "reprcrash": serialize_repr_crash(longrepr.reprcrash), |
| 579 | "reprtraceback": serialize_repr_traceback(longrepr.reprtraceback), |
| 580 | "sections": longrepr.sections, |
| 581 | } |
| 582 | if isinstance(longrepr, ExceptionChainRepr): |
| 583 | result["chain"] = [] |
| 584 | for repr_traceback, repr_crash, description in longrepr.chain: |
| 585 | result["chain"].append( |
| 586 | ( |
| 587 | serialize_repr_traceback(repr_traceback), |
| 588 | serialize_repr_crash(repr_crash), |
| 589 | description, |
| 590 | ) |
| 591 | ) |
| 592 | else: |
| 593 | result["chain"] = None |
| 594 | return result |
| 595 | |
| 596 | d = report.__dict__.copy() |
| 597 | if hasattr(report.longrepr, "toterminal"): |
no test coverage detected