New issue 731: Long reprs containing curly braces can break assertion rewriting.
https://bitbucket.org/pytest-dev/pytest/issue/731/long-reprs-containing-curly-braces-can
Carl Meyer:
`pytest.assertion.util._collapse_false(explanation)` breaks if the input
explanation text has unbalanced curly braces.
This explanation text often contains object `repr()`s.
`pytest.assertion.util.assertrepr_compare` uses `py.io.saferepr` to get the
object `repr()`s and include them in the explanation.
`py.io.saferepr` will elide overly long object `repr()`s with `...`. In doing
so, it can sometimes elide an `}` but not the corresponding `{`, if a `repr()`
contains curly braces in it.
When this happens, it causes `_collapse_false` to fail with `AssertionError:
unbalanced braces`.
I think this could be fixed in `saferepr` by making it smart about curly
braces. I can work on a patch for that, if it's deemed worth doing.
_______________________________________________
pytest-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pytest-commit