Fix elision of long collections in assertion messages with -vv (#14748)
The message part of
assert cond, msgwent throughsaferepr(obj, maxsize), where-vvmaps tomaxsize=None. That lifts the overall string-length cap, butSafeReprstill inherits reprlib’s per-container limits (maxlist=6etc.), so e.g.assert False, dir("")stayed elided with...at any verbosity — the exact reproducer from issue #12307, which #12662 only partially fixed (it covered long scalar reprs but not collections).Use the
_safereprhelper instead, as originally proposed in #12322: it routesmaxsize=Nonetosaferepr_unlimited(), which uses a plainrepr(), matching how asserted expressions are already displayed at high verbosity.Closes #12322 Fixes #12307
Claude-Session: https://claude.ai/code/session_01QgcKk5Az2fxFFfEP2tQ9Sk
Co-authored-by: Claude noreply@anthropic.com Co-authored-by: Sorin Sbarnea sorin.sbarnea@gmail.com
The pytest framework makes it easy to write small tests, yet scales to support complex functional testing
版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9
京公网安备 11010802047560号