(rep: BaseReport)
| 477 | return None |
| 478 | |
| 479 | def serialize_exception_longrepr(rep: BaseReport) -> Dict[str, Any]: |
| 480 | assert rep.longrepr is not None |
| 481 | # TODO: Investigate whether the duck typing is really necessary here. |
| 482 | longrepr = cast(ExceptionRepr, rep.longrepr) |
| 483 | result: Dict[str, Any] = { |
| 484 | "reprcrash": serialize_repr_crash(longrepr.reprcrash), |
| 485 | "reprtraceback": serialize_repr_traceback(longrepr.reprtraceback), |
| 486 | "sections": longrepr.sections, |
| 487 | } |
| 488 | if isinstance(longrepr, ExceptionChainRepr): |
| 489 | result["chain"] = [] |
| 490 | for repr_traceback, repr_crash, description in longrepr.chain: |
| 491 | result["chain"].append( |
| 492 | ( |
| 493 | serialize_repr_traceback(repr_traceback), |
| 494 | serialize_repr_crash(repr_crash), |
| 495 | description, |
| 496 | ) |
| 497 | ) |
| 498 | else: |
| 499 | result["chain"] = None |
| 500 | return result |
| 501 | |
| 502 | d = report.__dict__.copy() |
| 503 | if hasattr(report.longrepr, "toterminal"): |
no test coverage detected