MCPcopy
hub / github.com/pytest-dev/pytest / saferepr_unlimited

Function saferepr_unlimited

src/_pytest/_io/saferepr.py:139–155  ·  view source on GitHub ↗

Return an unlimited-size safe repr-string for the given object. As with saferepr, failing __repr__ functions of user instances will be represented with a short exception info. This function is a wrapper around simple repr. Note: a cleaner solution would be to alter ``saferepr``thi

(obj: object, use_ascii: bool = True)

Source from the content-addressed store, hash-verified

137
138
139def saferepr_unlimited(obj: object, use_ascii: bool = True) -> str:
140 """Return an unlimited-size safe repr-string for the given object.
141
142 As with saferepr, failing __repr__ functions of user instances
143 will be represented with a short exception info.
144
145 This function is a wrapper around simple repr.
146
147 Note: a cleaner solution would be to alter ``saferepr``this way
148 when maxsize=None, but that might affect some other code.
149 """
150 try:
151 if use_ascii:
152 return ascii(obj)
153 return repr(obj)
154 except Exception as exc:
155 return _format_repr_exception(exc, obj)

Callers 4

_safereprFunction · 0.90
assertrepr_compareFunction · 0.90
test_saferepr_unlimitedFunction · 0.90

Calls 1

_format_repr_exceptionFunction · 0.85

Tested by 2

test_saferepr_unlimitedFunction · 0.72