Return a pretty printed string for the given object. Failing __repr__ functions of user instances will be represented with a short exception info.
(obj: object)
| 106 | |
| 107 | |
| 108 | def safeformat(obj: object) -> str: |
| 109 | """Return a pretty printed string for the given object. |
| 110 | |
| 111 | Failing __repr__ functions of user instances will be represented |
| 112 | with a short exception info. |
| 113 | """ |
| 114 | try: |
| 115 | return pprint.pformat(obj) |
| 116 | except Exception as exc: |
| 117 | return _format_repr_exception(exc, obj) |
| 118 | |
| 119 | |
| 120 | # Maximum size of overall repr of objects to display during assertion errors. |
no test coverage detected